aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_parser.c
Commit message (Collapse)AuthorAgeFilesLines
* lavc/refstruct: move to lavu and make publicAnton Khirnov2024-12-151-2/+2
| | | | It is highly versatile and generally useful.
* avcodec/h264_parser: saturate dts a bitMichael Niedermayer2023-10-081-2/+2
| | | | | | | | Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long' Fixes: 51896/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6112289464123392 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_ps: Use RefStruct API for SPS/PPSAndreas Rheinhardt2023-10-071-7/+2
| | | | | | | | | | | | | | Avoids allocations and error checks for these allocations; e.g. syncing buffers across threads can't fail any more and needn't be checked. It also avoids having to keep H264ParamSets.pps and H264ParamSets.pps_ref and PPS.sps and PPS.sps_ref in sync and gets rid of casts and indirections. (The removal of these checks and the syncing code even more than offset the additional code for RefStruct.) Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf: use AV_CODEC_PROP_FIELDS where appropriateAnton Khirnov2023-05-151-2/+2
| | | | | | | | | | H.264 and mpeg12 parsers need to be adjusted at the same time to stop using the value of AVCodecContext.ticks_per_frame, because it is not set correctly unless the codec has been opened. Previously this would result in both the parser and lavf seeing the same incorrect value, which would cancel out. Updating lavf and not the parsers would result in correct value in lavf, but the wrong one in parsers, which would break some tests.
* avcodec: remove FF_API_AVCTX_TIMEBASEJames Almer2023-02-091-3/+4
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h2645_sei: Factor parsing common SEI messages outAndreas Rheinhardt2022-12-011-3/+3
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal.h: Move avpriv_find_start_code() to startcode.hAndreas Rheinhardt2022-02-081-2/+1
| | | | | | | | This is by definition the appropriate place for it. Remove all the now unnecessary libavcodec/internal.h inclusions; also remove other unnecessary headers from the affected files. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/h264_parser: add missing headersAnton Khirnov2022-01-261-0/+3
|
* lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNTAnton Khirnov2022-01-261-1/+1
| | | | | | They apparently serve the same purpose; the latter is one larger and has a comment explaining how the value is derived, so seems more trustworthy.
* avcodec/h264dec: Move find_start_code() to its only userAndreas Rheinhardt2022-01-261-0/+9
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_parser: don't alter decoder private dataJames Almer2022-01-241-5/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_parser: Set AVCodecContext.framerateNicolas Gaullier2021-09-231-0/+11
| | | | | Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_parser: Fix nalsize checkMichael Niedermayer2021-09-081-2/+2
| | | | | | | | Fixes: Assertion failure Fixes: 37463/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-4914693494931456 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_parser: Fix undefined left shiftAndreas Rheinhardt2021-08-201-3/+4
| | | | | | | | | | | | | | Use an uint32_t for the NAL unit size of an AVC H.264 NAL unit instead of an int as a left shift of a signed value is undefined behaviour if the result doesn't fit into the target type. Also make the log message never output negative lengths. Fixes: left shift of 16711968 by 8 places cannot be represented in type 'int' Fixes: 36601/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6581933285965824 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Move all AVCodecParser.split functions to remove_extradata_bsfAndreas Rheinhardt2021-04-271-38/+0
| | | | | | | The remove_extradata bsf is the only user of these functions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Constify all the AVCodecParsersAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | Possible now that the next pointer no longer exists. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* h264_ps: make the PPS hold a reference to its SPSAnton Khirnov2020-04-101-14/+2
| | | | | | | | It represents the relationship between them more naturally and will be useful in the following commits. Allows significantly more frames in fate-h264-attachment-631 to be decoded.
* h264_sei: parse the picture timing SEIs correctlyAnton Khirnov2020-04-101-0/+9
| | | | | | | | | Those SEIs refer to the currently active SPS. However, since the SEI NALUs precede the coded picture data in the bitstream, the active SPS is in general not known when we are decoding the SEI. Therefore, store the content of the picture timing SEIs and actually parse it when the active SPS is known.
* avcodec/h264_parser: Reduce needed history for parsing mb indexMichael Niedermayer2018-06-251-8/+11
| | | | | | | | | | This fixes a bug/regression with very small packets Fixes: output_file Regression since: 0782fb6bcb32fe3ab956a99af4cc472ff81da0c2 Reported-by: Thierry Foucu <tfoucu@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-171-1/+3
| | | | | | | | | | 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_sei: remove redundant prefix to H264SEIFramePacking fieldsJames Almer2017-12-011-1/+1
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* h2645_parse: Allocate a single buffer per packetKieran Kunhya2017-11-041-4/+9
| | | | | Drastically reduces memory usage on pathological streams. Fixes ticket #6789
* h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-09-121-13/+13
| | | | | | | This avoids confusion with equivalent H.265 SEI values when both are being used at the same time. (cherry picked from commit 6ea220cbeec8863e2006a03b73bed52db2b13ee7)
* avcodec/h264_parse: Check picture structure when initializing weight tableMichael Niedermayer2017-06-101-1/+1
| | | | | | | | 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/h264_sei: Check actual presence of SEI picture timing instead of ↵Michael Niedermayer2017-02-151-2/+2
| | | | | | implying it Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/h264_parser: export field order in more casesRodger Combs2016-10-241-1/+15
|
* avcodec/h264_parser: fix for possible overflowPaul B Mahol2016-09-141-2/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/h264_parser: set missing pts for top/bottom field framesPaul B Mahol2016-09-141-0/+22
| | | | | | Adopted from 4eb49fdde8f84d54a763cfb5d355527b525ee2bf revert. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/h264_parser: Factor get_avc_nalsize() outMichael Niedermayer2016-08-201-21/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h2645: Fix NAL unit paddingMichael Niedermayer2016-08-181-1/+1
| | | | | | | | | 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>
* Merge commit '5c2fb561d94fc51d76ab21d6f7cc5b6cc3aa599c'James Almer2016-08-011-18/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | * 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-211-14/+14
| | | | | | | | | | This will prevent conflicts e.g. in code that deals with both h264 and hevc.
* | Merge commit 'b24dafe10572254ff0decc18b0d7c3d3707d5a29'James Almer2016-08-011-1/+1
|\| | | | | | | | | | | | | * commit 'b24dafe10572254ff0decc18b0d7c3d3707d5a29': lavc: drop unnecessary h264dec.h includes Merged-by: James Almer <jamrial@gmail.com>
| * lavc: drop unnecessary h264dec.h includesAnton Khirnov2016-06-211-1/+1
| |
* | Merge commit 'f638b67e5790735f34620bf82025c9b9d6fc7216'James Almer2016-08-011-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | * 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-211-0/+1
| | | | | | | | | | 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-291-0/+1
|\| | | | | | | | | | | | | * 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-211-0/+1
| | | | | | | | | | | | 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-291-1/+1
|\| | | | | | | | | | | | | * 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-211-1/+1
| | | | | | | | This is more consistent with the naming of other decoders.
* | avcodec/h264_parser: Set sps/pps_refMichael Niedermayer2016-07-021-2/+15
| | | | | | | | | | | | | | | | Fixes use of freed memory Should fix valgrind failures of fate-h264-skip-nointra Found-by: logan Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | h264: make H264ParamSets sps constBenoit Fouet2016-06-301-1/+1
| |
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-1/+1
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-1/+1
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | lavc/h264_ps: add ff_h264_ps_uninit and use itMatthieu Bouron2016-06-201-7/+1
| |
* | lavc/h264_parser: replace AVCodecContext with logging ctx in scan_mmco_reset()Clément Bœsch2016-06-201-6/+6
| |
* | lavc/h264: add a logging ctx to ff_h264_pred_weight_table()Clément Bœsch2016-06-201-1/+1
| |
* | Merge commit '72da8d9bb24d1b1bf74c2f1108650c0da0054d2e'Clément Bœsch2016-06-191-63/+38
|\| | | | | | | | | | | | | * commit '72da8d9bb24d1b1bf74c2f1108650c0da0054d2e': h264_parser: remove the remaining dependencies on the h264 decoder Merged-by: Clément Bœsch <u@pkh.me>
| * h264_parser: remove the remaining dependencies on the h264 decoderAnton Khirnov2016-04-241-62/+36
| |
* | lavc/h264: move history parsing variable to H264ParseContextClément Bœsch2016-06-191-7/+9
| | | | | | | | This makes h264_find_frame_end() not depend on H264Context anymore.