summaryrefslogtreecommitdiff
path: root/libavcodec/h264dec.c
Commit message (Collapse)AuthorAge
* 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(-)
* Merge commit 'f1af37b51033ad90e56a8d7dfcc366f2bd9d2fed'Clément Bœsch2017-05-05
|\ | | | | | | | | | | | | * commit 'f1af37b51033ad90e56a8d7dfcc366f2bd9d2fed': h264dec: make ff_h264_decode_init() static Merged-by: Clément Bœsch <cboesch@gopro.com>
| * h264dec: make ff_h264_decode_init() staticAnton Khirnov2017-01-09
| | | | | | | | It is not called from outside h264dec.c anymore.
| * 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
| * pthread_frame: ensure the threads don't run simultaneously with hwaccelAnton Khirnov2016-12-19
| |
| * h264dec: support broken files with mp4 extradata/annex b dataAnton Khirnov2016-10-02
| | | | | | | | Bug-Id: 966
| * h264dec: reset nb_slice_ctx_queued for hwaccel decodingAnton Khirnov2016-08-03
| | | | | | | | | | | | Fixes hwaccel decoding of files with multiple slices. Found-By: Mark Thompson <sw@jkqxz.net>
| * h264dec: do not call finish_setup() if we have not started a frameAnton Khirnov2016-07-20
| | | | | | | | | | Found-By: Jan Ruge <jan.s.ruge@gmail.com> Bug-Id: 952
* | h264: revert 1189af429211ac650aac730368a6cf5b23756605.Ronald S. Bultje2017-03-28
| | | | | | | | The patch introduces race conditions.
* | pthread_frame: ensure the threads don't run simultaneously with hwaccelAnton Khirnov2017-03-21
| | | | | | | | | | | | Merges Libav commit 8dfba25c. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* | lavc/h264dec: use OFFSET macroMatthieu Bouron2017-03-15
| |
* | avcodec/h264, videotoolbox: fix crash after VT decoder failsAman Gupta2017-03-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way videotoolbox hooks in as a hwaccel is pretty hacky. The VT decode API is not invoked until end_frame(), so alloc_frame() returns a dummy frame with a 1-byte buffer. When end_frame() is eventually called, the dummy buffer is replaced with the actual decoded data from VTDecompressionSessionDecodeFrame(). When the VT decoder fails, the frame returned to the h264 decoder from alloc_frame() remains invalid and should not be used. Before 9747219958060d8c4f697df62e7f172c2a77e6c7, it was accidentally being returned all the way up to the API user. After that commit, the dummy frame was unref'd so the user received an error. However, since that commit, VT hwaccel failures started causing random segfaults in the h264 decoder. This happened more often on iOS where the VT implementation is more likely to throw errors on bitstream anomolies. A recent report of this issue can be see in http://ffmpeg.org/pipermail/libav-user/2016-November/009831.html The issue here is that the dummy frame is still referenced internally by the h264 decoder, as part of the reflist and cur_pic_ptr. Deallocating the frame causes assertions like this one to trip later on during decoding: Assertion h->cur_pic_ptr->f->buf[0] failed at src/libavcodec/h264_slice.c:1340 With this commit, we leave the dummy 1-byte frame intact, but avoid returning it to the user. This reverts commit 9747219958060d8c4f697df62e7f172c2a77e6c7. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* | Merge commit '76f7e70aa04fc5dbef5242b11cbf8fe4499f61d4'Clément Bœsch2017-01-31
|\| | | | | | | | | | | | | | | | | * commit '76f7e70aa04fc5dbef5242b11cbf8fe4499f61d4': h264dec: handle zero-sized NAL units in get_last_needed_nal() See 641dccc2aa5e0bf6b3c06998f9a7f24a5cf725e7 Merged-by: Clément Bœsch <cboesch@gopro.com>
| * h264dec: handle zero-sized NAL units in get_last_needed_nal()Anton Khirnov2016-07-20
| | | | | | | | | | | | | | | | The current code will ignore the init_get_bits() failure and do an invalid read from the uninitialized GetBitContext. Found-By: Jan Ruge <jan.s.ruge@gmail.com> Bug-Id: 952
| * h264dec: make sure not to call finish_setup() more than once per frameAnton Khirnov2016-07-20
| | | | | | | | It does not break anything currently, but should not be done anyway.
* | avcodec/h264dec: Clear ref_count on slice header processing failureMichael Niedermayer2017-01-27
| | | | | | | | | | | | | | | | | | Fixes using freed memory Introduced in 744801989099df26e90b00062c645969c5347533 Fixes: 471/fuzz-1-ffmpeg_VIDEO_AV_CODEC_ID_H264_fuzzer 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.
* | avcodec/h264dec: Fix regression with "make fate-h264-attachment-631 THREADS=8"Michael Niedermayer2017-01-24
| | | | | | | | | | | | | | | | | | | | | | | | This treats the case of no slices like no frames which it basically is. The field is added to the context as other nal related fields are also there and passing the has_slices field per *arguments is ugly and not consistent Found-by: ubitux Approved-by: ubitux Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/error_resilience: Optimize motion recovery code by using blcok listsMichael Niedermayer2017-01-22
| | | | | | | | | | | | | | | | | | | | | | | | This makes the code 7 times faster with the testcase from libfuzzer and should reduce the amount of timeouts we hit in automated fuzzing. (for example 438/fuzz-2-ffmpeg_VIDEO_AV_CODEC_ID_RV40_fuzzer) The code is also faster with more realistic input though the difference is small here as that is far from the worst cases the fuzzers pick out Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/h264dec: re-indent after previous commitMatthieu Bouron2017-01-20
| |
* | lavc/h264dec: make sure a slice is decoded before finishing setupMatthieu Bouron2017-01-20
| | | | | | | | | | Fixes regression in fate-h264-attachment-631 with THREADS=8 introduced by bdbbb8f11edbf10add874508c5125c174d8939be.
* | lavc/h264dec: remove flush goto in decode callbackClément Bœsch2017-01-18
| |
* | 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/h264dec: reconstruct and debug flush frames as wellClément Bœsch2017-01-16
| |
* | lavc/h264dec: Improve "Increasing reorder buffer" message loglevel.Carl Eugen Hoyos2016-08-23
| | | | | | | | | | Do not show the message for the first frame by default, show a warning if increasing is necessary in the middle of the stream.
* | avcodec/h2645: Fix NAL unit paddingMichael Niedermayer2016-08-18
| | | | | | | | | | | | | | | | | | The parser changes have lost the support for the needed padding, this adds it back Fixes out of array reads Fixes: 03ea21d271abc8acf428d42ace51d8b4/asan_heap-oob_3358eef_5692_16f0cc01ab5225e9ce591659e5c20e35.mkv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | h264dec: Fix indentationTimothy Gu2016-08-04
| |
* | Merge commit '58640fe89ec4f2a3d67c0a2585fca8de34440857'Timothy Gu2016-08-03
|\| | | | | | | | | | | | | | | | | | | * commit '58640fe89ec4f2a3d67c0a2585fca8de34440857': h264: handle frame recovery in h264_field_start() Conflicts: libavcodec/h264dec.c Merged-by: Timothy Gu <timothygu99@gmail.com>
| * h264: handle frame recovery in h264_field_start()Anton Khirnov2016-06-21
| | | | | | | | | | | | This is a more appropriate place for this. H264Context.recovery_frame is shared between frame threads, so modifying it where it is right now is invalid.
* | Merge commit 'e26c64148be8a20ace7512d96503172fb5e9753b'Timothy Gu2016-08-03
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit 'e26c64148be8a20ace7512d96503172fb5e9753b': h264: discard slices of redundant pictures right after parsing the slice header Conflicts: libavcodec/h264_slice.c libavcodec/h264dec.c TODO: fix indentation Merged-by: Timothy Gu <timothygu99@gmail.com>
| * h264: discard slices of redundant pictures right after parsing the slice headerAnton Khirnov2016-06-21
| | | | | | | | | | Going through the whole decoder initialization process for a slice we are not going to decode is unnecessary and potentially dangerous.
| * h264: call the hwaccel frame_start() from h264_field_start()Anton Khirnov2016-06-21
| | | | | | | | This is a more appropriate place for it.
* | Revert "Revert "Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'""Timothy Gu2016-08-03
| | | | | | | | | | | | | | This reverts commit e4af9be0f45c8f2ca148fb971f1e0c6782530e8c and redoes 796027f22154c799e0063e2457b31e0cfd1dddae. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* | Revert "Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'"Timothy Gu2016-08-03
| | | | | | | | | | | | | | This reverts commit 796027f22154c799e0063e2457b31e0cfd1dddae, reversing changes made to bca30ed2b67f095fd31e07319a622ac30ad22978. Preemptive revert before further testing has been done.
* | Merge commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22'Timothy Gu2016-08-03
|\| | | | | | | | | | | | | | | | | | | | | * commit 'd1d7678040cd60148f97b372cb4291bcc45b2e22': h264: fix the check for mixed IDR/non-IDR slices Conflicts: libavcodec/h264_slice.c libavcodec/h264dec.c Merged-by: Timothy Gu <timothygu99@gmail.com>
| * h264: fix the check for mixed IDR/non-IDR slicesAnton Khirnov2016-06-21
| |
* | Merge commit 'bc7f4268514624e1286ea76d27a89a56b4ee18e1'James Almer2016-08-01
|\| | | | | | | | | | | | | | | | | | | * commit 'bc7f4268514624e1286ea76d27a89a56b4ee18e1': h264: drop tests whether the codec id is AV_CODEC_ID_H264 Conflicts: libavcodec/h264dec.c Merged-by: James Almer <jamrial@gmail.com>
| * h264: drop tests whether the codec id is AV_CODEC_ID_H264Anton Khirnov2016-06-21
| | | | | | | | Those are unused remnants of the old SVQ3 code.
* | Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'James Almer2016-08-01
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c': h264: add H264_ prefix to the NAL unit types Conflicts: libavcodec/h264_parse.c libavcodec/h264_parser.c libavcodec/h264_slice.c libavcodec/h264dec.c Merged-by: James Almer <jamrial@gmail.com>
| * h264: add H264_ prefix to the NAL unit typesAnton Khirnov2016-06-21
| | | | | | | | | | This will prevent conflicts e.g. in code that deals with both h264 and hevc.
* | Merge commit 'f638b67e5790735f34620bf82025c9b9d6fc7216'James Almer2016-08-01
|\| | | | | | | | | | | | | | | | | | | | | | | * commit 'f638b67e5790735f34620bf82025c9b9d6fc7216': h264: move the parameter set definitions to a new header file Conflicts: libavcodec/h264_parse.h libavcodec/h264_ps.c libavcodec/h264dec.h Merged-by: James Almer <jamrial@gmail.com>
| * h264: move the parameter set definitions to a new header fileAnton Khirnov2016-06-21
| | | | | | | | | | The PS parsing code is independent from the decoder, so it makes more sense for it to have its own separate header.
* | Merge commit '251cbb44003caf179fb17afbb8a6c56643c2a646'Clément Bœsch2016-07-29
|\| | | | | | | | | | | | | * commit '251cbb44003caf179fb17afbb8a6c56643c2a646': h264: create a new header for common h264 definitions Merged-by: Clément Bœsch <u@pkh.me>
| * h264: create a new header for common h264 definitionsAnton Khirnov2016-06-21
| | | | | | | | | | | | Move the NAL unit types into it. This will allow to stop including the whole decoder-specific h264dec.h in some code that is unrelated to the decoder and only needs some enum values.
* | Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'Clément Bœsch2016-07-29
|/ | | | | | | * commit '9df889a5f116c1ee78c2f239e0ba599c492431aa': h264: rename h264.[ch] to h264dec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
* h264: rename h264.[ch] to h264dec.[ch]Anton Khirnov2016-06-21
This is more consistent with the naming of other decoders.