Michael Niedermayer
4da2ac5c7a
avcodec/h264: Fix regression caused by removial of default_ref_list
...
This fixes a regression of the sample from Ticket 2371
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
9 years ago
Anton Khirnov
741b494fa8
h264: eliminate default_ref_list
...
According to the spec, the reference list for a slice should be
constructed by first generating an initial (what we now call "default")
reference list and then optionally applying modifications to it.
Our code has an optimization where the initial reference list is
constructed for the first inter slice and then rebuilt for other slices
if needed. This, however, adds complexity to the code, requires an extra
2.5kB array in the codec context and there is no reason to think that it
has any positive effect on performance. Therefore, simplify the code by
generating the reference list from scratch for each slice.
9 years ago
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>
9 years ago
wm4
069190f707
avcodec/h264: keep SPS and PPS bitstream data
...
We assume an upper bound of 4096 bytes for each raw SPS/PPS. It's hard
to determine an exact maximum size, but this value was was considered
high enough and safe.
Needed for the following VideotoolBox commit.
9 years ago
Kieran Kunhya
b0017579b6
h264: Add support for Closed Caption export
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Kieran Kunhya
8234f0e3b4
avcodec: Add support for Closed Caption export in h264
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Nicolas DEROUINEAU
04a68f4348
avcodec/h264: Greenmetadata SEI parsing
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
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>
10 years ago
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.
10 years ago
Anton Khirnov
e49e0f58e2
h264: make sure the slices do not overlap during slice threading
...
Based on a patch by Michael Niedermayer <michaelni@gmx.at>.
CC: libav-stable@libav.org
Found-by: Kieran Kunhya <kierank@obe.tv>
10 years ago
Kieran Kunhya
22291c372f
avcodec: Add support for per-frame AFD output in h264
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Andreas Cadhalpun
1189af4292
h264: update avctx width/height/pix_fmt when returning frame
...
Inconsistencies between the dimensions/pixel format of avctx and the
frame can confuse API users.
For example this can crash the demuxing_decoding example.
Back up the previous values and restore them, when decoding the next
frame. This is necessary, because these can be different between the
returned frame and the last decoded frame.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
10 years ago
Anton Khirnov
a0f2946068
h264: use properly allocated AVFrames
10 years ago
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.
10 years ago
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.
10 years ago
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.
10 years ago
Anton Khirnov
9d33bab583
h264: drop H264Context.ouputed_poc
...
It is only set, but never used for anything.
10 years ago
Anton Khirnov
27b0e6ebfd
h264: drop needs_realloc
...
It is not needed anymore since switching to refcounted frames.
10 years ago
Vittorio Giovara
6a85dfc830
lavc: Replace av_dlog and tprintf with internal macros
10 years ago
Michael Niedermayer
bc48c88918
avcodec/h264: Do not fail with randomly truncated VUIs
...
Fixes Ticket4445
Tested-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
795199fca4
avcodec/h264: use consistent argument name in MB_FIELD() macro
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
43b434210e
avcodec/h264: Fix race between slices where one overwrites data from the next
...
Fixes non deterministic crash in ticket4408/fuzz2.264
Likely fixes other samples as well
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
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.
10 years ago
Michael Niedermayer
354db19ff4
avcodec/h264: Remove bits_per_raw_sample hacks
...
Fixes assertion failure
Fixes: f12c79769501ee471a5c731b8304ffcb/signal_sigabrt_7ffff6ac8cc9_3766_cov_4267830138_undemuxable_h264.ts
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
0346783c98
avcodec/h264.h: Drop unused macro
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Anton Khirnov
c28ed1d743
h264: move [uv]linesize to the per-slice context
...
While it is a per-frame variable, it is only really used in the
low-level decoding code, so it is more efficient to store it in the
slice context.
10 years ago
Anton Khirnov
a12d3188cb
h264: use a smaller struct for the ref lists
...
There is no need to store a whole H264Picture, with a full AVFrame
embedded in it. This should allow getting rid of the embedded AVFrame
later.
10 years ago
Anton Khirnov
5bf3c0fa49
h264: drop the now unused per-slice H264Contexts
10 years ago
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.
10 years ago
Anton Khirnov
3178f4d33f
h264: move rbsp_buffer into the per-slice context
10 years ago
Anton Khirnov
582683b6ac
h264: move remaining ER stuff into the per-slice context
10 years ago
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.
10 years ago
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.
10 years ago
Anton Khirnov
34d4c605e9
h264_loopfilter: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
Anton Khirnov
7505c8dfba
h264_cavlc: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
Anton Khirnov
ba7e165b86
h264_cabac: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
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
10 years ago
Anton Khirnov
e9b2383bf8
h264: move mb_mbaff into the per-slice context
10 years ago
Anton Khirnov
bc98e8c0e0
h264: move mb_field_decoding_flag into the per-slice context
10 years ago
Anton Khirnov
6490a0c0fb
h264_mb: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
Anton Khirnov
460176aa19
h264.h: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
Anton Khirnov
d27b8248a6
h264_direct: constify all uses of H264Context
...
All the variables modified by this code are either per-MB arrays or have
been moved to the per-slice context
10 years ago
Anton Khirnov
f42485dbce
h264: use a separate GetBitContext for slice data
10 years ago
Anton Khirnov
404a416d4b
h264: remove some remnants of data partitioning
10 years ago
Anton Khirnov
7bbc254d64
h264: move resync_mb_{x,y} into the per-slice context
10 years ago
Anton Khirnov
d4d9068cdf
h264: move mb_{x,y} into the per-slice context
10 years ago
Anton Khirnov
0edbe6faa7
h264: move mb_xy into the per-slice context
10 years ago
Anton Khirnov
07c5ca551b
h264: move is_complex into the per-slice context
10 years ago
Anton Khirnov
47a0d39350
h264: move mb_skip_run into the per-slice context
10 years ago
Anton Khirnov
9951907f6f
h264: move redundant_pic_count into the per-slice context
10 years ago