summaryrefslogtreecommitdiff
path: root/libavcodec/h264_slice.c
Commit message (Collapse)AuthorAge
* h264: Support multi-field closed captions by using AVBufferRef and not ↵Kieran Kunhya2018-08-17
| | | | | | resetting per field Signed-off-by: Josh de Kock <joshdk@obe.tv>
* h264_slice: Fix return of incomplete frames from decoderJohn Stebbins2018-06-28
| | | | | | | | | | | When not using libavformat for demuxing, AVCodecContext.has_b_frames gets set too late causing the recovery frame heuristic in h264_refs to incorrectly flag an early frame as recovered. This patch sets has_b_frames earlier to prevent improperly flagging the frame as recovered. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264_slice: Fix integer overflow with last_pocMichael Niedermayer2018-04-12
| | | | | | | | Fixes: signed integer overflow: 2147483646 - -2816 cannot be represented in type 'int' Fixes: crbug 823145 Reported-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264: Increase field_poc to 64bit in ff_h264_init_poc() to detect ↵Michael Niedermayer2018-02-17
| | | | | | | | | | overflows Fixes: Integer overflow Fixes: 5746/clusterfuzz-testcase-minimized-6270097623613440 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264_slice: Do not attempt to render into frames already outputMichael Niedermayer2018-01-07
| | | | | | | | | | Fixes: null pointer dereference Fixes: 4698/clusterfuzz-testcase-minimized-5096956322906112 This testcase does not reproduce the issue before 03b82b3ab9883cef017e513c7d0b3b986b3b3e7b Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h264_slice: use H264_SEI_FpaType enum constantsJames Almer2017-12-01
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: remove redundant prefix to H264SEIFramePacking fieldsJames Almer2017-12-01
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'James Almer2017-11-29
|\ | | | | | | | | | | | | * commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa': stereo3d: Support view type for frame sequence type Merged-by: James Almer <jamrial@gmail.com>
| * stereo3d: Support view type for frame sequence typeVittorio Giovara2017-11-28
| | | | | | | | | | | | Implement detection in h264 and hevc and insertion in framepack filter. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * h264: Add support for alternative transfer characterics SEIVittorio Giovara2017-08-10
| | | | | | | | | | | | | | | | | | | | The use of this SEI is for backward compatibility in HLG HDR systems: older devices that cannot interpret the "arib-std-b67" transfer will get the compatible transfer (usually bt709 or bt2020) from the VUI, while newer devices that can interpret HDR will read the SEI and use its value instead. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * h264dec: add a CUVID hwaccelAnton Khirnov2017-07-26
| | | | | | | | | | Some parts of the code are based on a patch by Timo Rothenpieler <timo@rothenpieler.org>
* | h264dec: add a NVDEC hwaccelAnton Khirnov2017-11-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some parts of the code are based on a patch by Timo Rothenpieler <timo@rothenpieler.org> Merges Libav commit b9129ec4668c511e0a79e25c6f25d748cee172c9. Due to the name clash with our cuvid decoder, rename it to nvdec. This commit also changes the Libav code to dynamic loading of the cuda/cuvid libraries. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* | Merge commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4'James Almer2017-11-08
|\| | | | | | | | | | | | | * commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4': h264dec: track the last seen value of x264_build Merged-by: James Almer <jamrial@gmail.com>
| * h264dec: track the last seen value of x264_buildAnton Khirnov2017-07-26
| | | | | | | | | | | | | | | | | | | | Do not use the one in the SEI directly as that is reset at certain points. Inspired by patches from Michael Niedermayer <michaelni@gmx.at> and Anton Mitrofanov <BugMaster@narod.ru>. CC: libav-stable@libav.org
| * dxva: add support for new dxva2 and d3d11 hwaccel APIswm42017-06-08
| | | | | | | | | | | | | | | | | | | | This also adds support to avconv (which is trivial due to the new hwaccel API being generic enough). The new decoder setup code in dxva2.c is significantly based on work by Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites. Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-05-16
| | | | | | | | | | This avoids confusion with equivalent H.265 SEI values when both are being used at the same time.
* | lavc: drop VDAClément Bœsch2017-10-23
| | | | | | | | | | Deprecated (aka removed) in OSX 10.11, and we have a replacement for it (VideoToolbox).
* | Merge commit '7b917041184874e7d7cba4450813de7e0bb28a33'James Almer2017-10-21
|\| | | | | | | | | | | | | * commit '7b917041184874e7d7cba4450813de7e0bb28a33': lavc: Drop deprecated VDPAU codec capability Merged-by: James Almer <jamrial@gmail.com>
| * h264_sei: Check actual presence of picture timing SEI messageMichael Niedermayer2017-02-28
| | | | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * golomb: Convert to the new bitstream readerDiego Biurrun2017-01-31
| |
| * h264dec: export cropping information instead of handling it internallyAnton Khirnov2017-01-12
| |
| * h264dec: be more explicit in handling container croppingAnton Khirnov2017-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | The current condition can trigger in cases where it shouldn't, with unexpected results. Make sure that: - container cropping is really based on the original dimensions from the caller - those dimenions are discarded on size change The code is still quite hacky and eventually should be deprecated and removed, with the decision about which cropping is used delegated to the caller.
| * h264dec: drop a redundant checkAnton Khirnov2017-01-09
| | | | | | | | | | Cropping parameters are already checked for validity during SPS parsing, no need to check them again.
| * h264dec: make sure to only end a field if it has been startedAnton Khirnov2016-12-19
| | | | | | | | | | | | | | | | Calling ff_h264_field_end() when the per-field state is not properly initialized leads to all kinds of undefined behaviour. CC: libav-stable@libav.org Bug-Id: 977 978 992
| * h264_slice: Wait for refs to be available before we use them in error ↵Derek Buitenhuis2016-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | concealment This could happen when there was a frame number gap and frame threading was used. Debugging-by: Ronald S. Bultje <rsbultje@gmail.com> Debugging-by: Justin Ruggles <justin.ruggles@gmail.com> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> CC:libav-stable@libav.org Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-09-12
| | | | | | | | | | | | | | This avoids confusion with equivalent H.265 SEI values when both are being used at the same time. (cherry picked from commit 6ea220cbeec8863e2006a03b73bed52db2b13ee7)
* | h264: Add support for alternative transfer characterics SEIVittorio Giovara2017-08-10
| | | | | | | | | | | | | | | | | | | | The use of this SEI is for backward compatibility in HLG HDR systems: older devices that cannot interpret the "arib-std-b67" transfer will get the compatible transfer (usually bt709 or bt2020) from the VUI, while newer devices that can interpret HDR will read the SEI and use its value instead. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/h264_slice: Fix overflow in slice offsetMichael Niedermayer2017-08-05
| | | | | | | | | | | | | | | | Fixes: runtime error: signed integer overflow: 1610612736 * 2 cannot be represented in type 'int' Fixes: 2817/clusterfuzz-testcase-minimized-5289691240726528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/h264_slice: don't sync default_ref[] between threads.Wan-Teh Chang2017-07-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default_ref[] is unconditionally initialized in h264_initialise_ref_list() (called from ff_h264_build_ref_list(), called from h264_slice_init()). This fixes the following tsan warning when running fate-h264: WARNING: ThreadSanitizer: data race (pid=31070) Write of size 8 at 0x7bbc000082a8 by thread T1 (mutexes: write M1628): #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5 (ffmpeg+0x10de9d) #1 h264_initialise_ref_list ffmpeg/libavcodec/h264_refs.c:214:29 (ffmpeg+0x1186b3f) #2 ff_h264_build_ref_list ffmpeg/libavcodec/h264_refs.c:306 (ffmpeg+0x1186b3f) #3 h264_slice_init ffmpeg/libavcodec/h264_slice.c:1900:11 (ffmpeg+0x1191149) [..] Previous read of size 8 at 0x7bbc000082a8 by main thread (mutexes: write M1630): #0 memcpy /work/release-test/final/llvm.src/projects/compiler-rt/lib/tsan/../sanitizer_common/sanitizer_common_interceptors.inc:655:5 (ffmpeg+0x10de9d) #1 ff_h264_update_thread_context ffmpeg/libavcodec/h264_slice.c:411:5 (ffmpeg+0x118b7dc) Signed-off-by: Wan-Teh Chang <wtc@google.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* | avcodec/h264_slice: Fix signed integer overflowMichael Niedermayer2017-07-05
| | | | | | | | | | | | | | | | Fixes: runtime error: signed integer overflow: 26 + 2147483644 cannot be represented in type 'int' Fixes: 2456/clusterfuzz-testcase-minimized-4822695051001856 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dxva: add support for new dxva2 and d3d11 hwaccel APIswm42017-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also adds support to avconv (which is trivial due to the new hwaccel API being generic enough). The new decoder setup code in dxva2.c is significantly based on work by Steve Lhomme <robux4@gmail.com>, but with heavy changes/rewrites. Merges Libav commit f9e7a2f95a7194a8736cc1416a03a1a0155a3e9f. Also adds untested VP9 support. The check for DXVA2 COBJs is removed. Just update your MinGW to something newer than a 5 year old release. Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/h264_parse: Check picture structure when initializing weight tableMichael Niedermayer2017-06-10
| | | | | | | | | | | | | | | | Fixes: runtime error: index 49 out of bounds for type 'int [48][2][2]' Fixes: 2159/clusterfuzz-testcase-minimized-5267945972301824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/h264dec: export cropping information instead of handling it internallyJames Almer2017-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | | This merges commit c3e84820d67cb1d8cfb4196f9b43971308a81571 from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/h264_picture.c | 3 --- libavcodec/h264_ps.c | 9 --------- libavcodec/h264_slice.c | 25 +++++++++++++++++++------ libavcodec/h264dec.c | 13 +------------ libavcodec/h264dec.h | 9 +++++---- 5 files changed, 25 insertions(+), 34 deletions(-)
* | avcodec/h264dec: be more explicit in handling container croppingJames Almer2017-05-26
| | | | | | | | | | | | | | | | | | | | | | This merges commit 4fded0480f20f4d7ca5e776a85574de34dfead14 from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/h264_slice.c | 20 +++++++++++++------- libavcodec/h264dec.c | 3 +++ libavcodec/h264dec.h | 5 +++++ 3 files changed, 21 insertions(+), 7 deletions(-)
* | h264: don't re-call ff_h264_direct_ref_list_init() w/ frame-mt.Ronald S. Bultje2017-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | I'm hoping that this will address the remaining tsan fate-h264 issues: WARNING: ThreadSanitizer: data race (pid=24478) Read of size 8 at 0x7dbc0001c828 by main thread (mutexes: write M3243): #0 ff_h264_ref_picture src/libavcodec/h264_picture.c:107 (ffmpeg+0x0000013b78d8) [..] Previous write of size 1 at 0x7dbc0001c82e by thread T2 (mutexes: write M3245): #0 ff_h264_direct_ref_list_init src/libavcodec/h264_direct.c:137 (ffmpeg+0x000001382c93) But I'm not sure because I haven't been able to reproduce locally.
* | avcodec/h264: Check weight values to be within the specs limits.Michael Niedermayer2017-04-07
| | | | | | | | | | | | | | | | | | Fixes: integer overflows Fixes: 911/clusterfuzz-testcase-5415105606975488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | pthread_frame: allow per-field ThreadFrame owners.Ronald S. Bultje2017-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tries to handle cases where separate invocations of decode_frame() (each running in separate threads) write to respective fields in the same AVFrame->data[]. Having per-field owners makes interaction between readers (the referencing thread) and writers (the decoding thread) slightly more optimal if both accesses are field-based, since they will use the respective producer's thread objects (mutex/cond) instead of sharing the thread objects of the first field's producer. In practice, this fixes the following tsan-warning in fate-h264: WARNING: ThreadSanitizer: data race (pid=21615) Read of size 4 at 0x7d640000d9fc by thread T2 (mutexes: write M1006): #0 ff_thread_report_progress pthread_frame.c:569 (ffmpeg:x86_64+0x100f7cf54) [..] Previous write of size 4 at 0x7d640000d9fc by main thread (mutexes: write M1004): #0 update_context_from_user pthread_frame.c:335 (ffmpeg:x86_64+0x100f81abb)
* | h264: revert 1189af429211ac650aac730368a6cf5b23756605.Ronald S. Bultje2017-03-28
| | | | | | | | The patch introduces race conditions.
* | avcodec/h264_sei: Check actual presence of SEI picture timing instead of ↵Michael Niedermayer2017-02-15
| | | | | | | | | | | | implying it Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/h264_slice: Clear ref_counts on redundant slicesMichael Niedermayer2017-02-08
| | | | | | | | | | | | | | | | Fixes reading freed memory Fixes: 568/clusterfuzz-testcase-6107186067406848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '38efff92f1ef81f3de20ff0460ec7b70c253d714'Clément Bœsch2017-01-24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '38efff92f1ef81f3de20ff0460ec7b70c253d714': FATE: add a test for H.264 with two fields per packet h264: fix decoding multiple fields per packet with slice threads This merge includes two commits because the FATE test was useful in order to make proper testing. The merge gets rid of the now unused: - SLICE_SINGLETHREAD and SLICE_SKIPED macros - max_contexts - "again" label in decode_nal_units() This commit also includes the fix from d3e4d406b. Thanks to wm4 and Michael Niedermayer for their testing. Merged-by: Clément Bœsch <u@pkh.me> Merged-by: Matthieu Bouron <matthieu.bouron@gmail.com>
| * h264: fix decoding multiple fields per packet with slice threadsAnton Khirnov2016-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | Since we only know whether a NAL unit corresponds to a new field after parsing the slice header, this requires reorganizing the calls to slice parsing, per-slice/field/frame init and actual decoding. In the previous code, the function for slice header decoding also immediately started a new field/frame as necessary, so any slices already queued for decoding would no longer be decodable. After this patch, we first parse the slice header, and if we determine that a new field needs to be started we decode all the queued slices.
* | lavc/h264: simplify find_unused_picture()Clément Bœsch2017-01-19
| |
* | Merge commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a'Matthieu Bouron2017-01-17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'f450cc7bc595155bacdb9f5d2414a076ccf81b4a': h264: eliminate decode_postinit() Also includes fixes from 1f7b4f9abc and e344e65109. Original patch replace H264Context.next_output_pic (H264Picture *) by H264Context.output_frame (AVFrame *). This change is discarded as it is incompatible with the frame reconstruction and motion vectors display code which needs the extra information from the H264Picture. Merged-by: Clément Bœsch <u@pkh.me> Merged-by: Matthieu Bouron <matthieu.bouron@gmail.com>
| * h264: eliminate decode_postinit()Anton Khirnov2016-07-15
| | | | | | | | | | | | | | | | This function's purpose is not very well defined. Currently it does two (only marginally related) things: selecting the next output frame and calling ff_thread_finish_setup() for frame threading. The first of those more properly belongs under field_start(), while the second can be called directly from decode_nal_units().
* | lavc/h264_slice: drop redundant current_slice resetClément Bœsch2017-01-16
| | | | | | | | It is done unconditionally in ff_h264_field_end()
* | h264_slice: Wait for refs to be available before we use them in error ↵Derek Buitenhuis2016-12-09
| | | | | | | | | | | | | | | | | | | | | | | | concealment This could happen when there was a frame number gap and frame threading was used. This fixes #5458. Debugging-by: Ronald S. Bultje <rsbultje@gmail.com> Debugging-by: Justin Ruggles <justin.ruggles@gmail.com> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit 'a8cbe5a0ccebf60a8a8b0aba5d5716dd54c1595c'Hendrik Leppkes2016-11-17
|\| | | | | | | | | | | | | * commit 'a8cbe5a0ccebf60a8a8b0aba5d5716dd54c1595c': h264_ps: export actual height in MBs as SPS.mb_height Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * h264_ps: export actual height in MBs as SPS.mb_heightAnton Khirnov2016-07-11
| | | | | | | | | | | | | | | | | | | | | | | | Currently, SPS.mb_height is actually what the spec calls PicHeightInMapUnits, which is half the frame height when interlacing is allowed. Calling this 'mb_height' is quite confusing, and there are at least two associated bugs where this field is treated as the actual frame height - in the h264 parser and in the code computing maximum reordering buffer size for a given level. Fix those issues (and avoid possible future ones) by exporting the real frame height in this field.
| * h264: Eliminate unused but set variableDiego Biurrun2016-06-23
| | | | | | | | libavcodec/h264_slice.c:1384:9: warning: variable 'droppable' set but not used