Commit Graph

1176 Commits

Author SHA1 Message Date
Derek Buitenhuis
d15368ee39 h264: Run VLC init under pthread_once
This makes the h.264 decoder threadsafe to initialize.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-14 14:35:34 +02:00
Anton Khirnov
a8956eca1f cabac: Make CABAC states hardcoded
There is not much reason to generate such a small table at runtime.

Signed-off-by: Derek Buitenhuis <derekb@vimeo.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-10-08 21:55:31 +02:00
Luca Barbato
0f562f5b83 h264: Do not print an error when the buffer has to be refilled
Partially amends 9469370fb3
2015-08-06 11:55:48 +02:00
Jake Sebastian-Jones
9469370fb3 h264: Use AVERROR return codes instead of -1
And report why it fails.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-08-05 11:40:30 +02:00
John Högberg
b7040e67ec h264: fix AVDISCARD_NONKEY for some interlaced content
When skip_frame is set to _NONKEY the decoder skips everything except intra
slices, which breaks frames that consist of an intra field together with any
other field type; half the frame becomes garbage. This patch fixes the issue by
letting non-intra slices through if they're part of a keyframe.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-07-27 18:11:00 +02:00
Vittorio Giovara
059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara
7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Kieran Kunhya
b0017579b6 h264: Add support for Closed Caption export
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-17 01:44:22 +01:00
Vittorio Giovara
271ce76d31 h264: Parse registered data SEI message and AFD value
Partially based on code by Marton Balint and Kieran Kunhya.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-06-30 15:34:38 +02:00
Anton Khirnov
5ec0bdf2c5 h264: do not update the context fields copied between threads after finish_setup()
Should fix a large number of possible races with frame threading.
2015-06-27 16:48:48 +02:00
Anton Khirnov
a0f2946068 h264: use properly allocated AVFrames 2015-04-29 05:52:58 +02:00
Anton Khirnov
7a4f74eed5 h264: embed the DPB in the context
It now has a fixed size and is initialized only once, so there is no
point in allocating it separately.
2015-04-29 05:52:58 +02:00
Anton Khirnov
440e8dd374 h264: drop a comment that carries no useful information 2015-04-29 05:52:58 +02:00
Anton Khirnov
11f024ef0a h264: move freeing the escaped RBSP buffer to free_context()
It does not logically belong in free_tables(), since it's not allocated
in alloc_tables() and its size has nothing to do with the frame size.
2015-04-29 05:52:58 +02:00
Anton Khirnov
ee62b364be h264: eliminate ff_h264_set_parameter_from_sps()
That function currently does two things -- reinitializing the DSP
contexts and setting low_delay based on the SPS values.

The former more appropriately belongs in h264_slice_header_init(), while
the latter only really makes sense in decode_slice_header().

The third call to ff_h264_set_parameter_from_sps(), done immediately
after parsing a new SPS, appears to serve no useful purpose, so it is
just dropped.

Also, drop now unneeded H264Context.cur_chroma_format_idc.
2015-04-29 05:52:57 +02:00
Anton Khirnov
a6cd154463 h264: move the DPB init/uninit to init_context()/free_context()
Currently, the DPB is initialized in alloc_tables() and uninitialized in
free_tables(), but those functions manage frame size-dependent
variables, so DPB management does not logically belong in there.

Since we want the init/uninit to happen exactly once per the context
lifetime, init_context()/free_context() are the proper place for this
code.
2015-04-29 05:52:57 +02:00
Anton Khirnov
9d33bab583 h264: drop H264Context.ouputed_poc
It is only set, but never used for anything.
2015-04-29 05:52:57 +02:00
Anton Khirnov
27b0e6ebfd h264: drop needs_realloc
It is not needed anymore since switching to refcounted frames.
2015-04-29 05:52:57 +02:00
Vittorio Giovara
6a85dfc830 lavc: Replace av_dlog and tprintf with internal macros 2015-04-19 12:41:59 +01:00
Anton Khirnov
bd737b5178 h264: reset the private data in init_thread_copy()
The generic code copies the main context's private data to all the
others. However that is quite dangerous, as it might end up copying some
pointers that are or will become invalid.

Since everything we actually need will be copied later in
update_thread_context(), it's safest to zero the private data in
init_thread_copy(), so it works the same way as init for the main
context.
2015-04-05 12:03:07 +02:00
Anton Khirnov
a939e5b252 h264: remove a commented out nonsense line 2015-04-05 12:03:02 +02:00
Anton Khirnov
65afa65e73 h264: drop redundant initialization of the scaling matrices
It will always be initialized when actually parsing the PPS.
2015-04-05 12:02:57 +02:00
Anton Khirnov
e1f907711a h264: factor out common code from init() and init_thread_copy() 2015-04-05 12:02:35 +02:00
Anton Khirnov
43fd3dd80c h264: drop redundant initialization in init()
There is no real advantage to initializing any of those in init,
assuming yuv420, before the real stream parameters are known.
2015-04-05 12:02:26 +02:00
Anton Khirnov
050324d020 h264: initialize cur_chroma_format_idc
This makes sure the various DSP contexts get properly initialized in
ff_h264_set_parameter_from_sps() whatever the value of
raw_bits_per_sample.
2015-04-05 12:02:20 +02:00
Anton Khirnov
a4d34e218f h264: disable ER by default
The way it is currently designed is fundamentally unsafe and cannot be
reasonably fixed without completely rewriting it.
2015-04-03 13:14:43 +02:00
Anton Khirnov
2b4c38d3c6 h264: drop some mpegvideo remnants from draw_horiz_band()
This code makes no sense for h.264.
2015-03-21 11:27:16 +01:00
Anton Khirnov
5bf3c0fa49 h264: drop the now unused per-slice H264Contexts 2015-03-21 11:27:16 +01:00
Anton Khirnov
51d8725a6e h264: use the main H264Context as the parent for all slice contexts
There is now no need to have per-slice copies of the H264Context.
2015-03-21 11:27:15 +01:00
Anton Khirnov
3178f4d33f h264: move rbsp_buffer into the per-slice context 2015-03-21 11:27:15 +01:00
Anton Khirnov
582683b6ac h264: move remaining ER stuff into the per-slice context 2015-03-21 11:27:15 +01:00
Anton Khirnov
5bc69f38c1 error_resilience: do not require mbintra/skip tables
h264dec does not use them at all and only allocates them for ER.
2015-03-21 11:27:15 +01:00
Anton Khirnov
c377e04d8a h264: move top_borders into the per-slice context
Also change the method for allocating to the same one as used by
edge_emu_buffer.
2015-03-21 11:27:15 +01:00
Anton Khirnov
36d04801ba h264: move the scratch buffers into the per-slice context
Also change the method for allocating them. Instead of two possible
alloc calls from different places, just ensure they are allocated at the
start of each slice. This should be simpler and less bug-prone than the
previous method.
2015-03-21 11:27:15 +01:00
Anton Khirnov
5c4b98de4d h264.c: constify all uses of H264Context in slice and lower-level functions
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
2015-03-21 11:27:15 +01:00
Anton Khirnov
f42485dbce h264: use a separate GetBitContext for slice data 2015-03-21 11:27:14 +01:00
Anton Khirnov
2ea00e35e4 h264: do not abuse the context as a temporary storage in get_last_needed_nal()
Use a local variable instead.
2015-03-21 11:27:14 +01:00
Anton Khirnov
404a416d4b h264: remove some remnants of data partitioning 2015-03-21 11:27:14 +01:00
Anton Khirnov
d4d9068cdf h264: move mb_{x,y} into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov
0edbe6faa7 h264: move mb_xy into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov
9951907f6f h264: move redundant_pic_count into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov
a67f8ae9a2 h264: move mvd_table into the per-slice context 2015-03-21 11:27:14 +01:00
Anton Khirnov
95eb35f305 h264: move the ref lists variables into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov
066aafced4 h264: move direct_spatial_mv_pred into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov
56febc993b h264: move the slice type variables into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov
e6287f077c h264: move {mv,ref}_cache into the per-slice context 2015-03-21 11:27:13 +01:00
Anton Khirnov
f69574cf7a h264: move non_zero_count_cache into the per-slice context 2015-03-21 11:27:12 +01:00
Anton Khirnov
64c81b2cd0 h264: move *_samples_available into the per-slice context 2015-03-21 11:27:12 +01:00
Anton Khirnov
7d8154edd5 h264: move intra4x4_pred_mode[_cache] into the per-slice context 2015-03-21 11:27:12 +01:00