summaryrefslogtreecommitdiff
path: root/libavcodec/h264_parser.c
Commit message (Collapse)AuthorAge
* avcodec/internal.h: Move avpriv_find_start_code() to startcode.hAndreas Rheinhardt2022-02-08
| | | | | | | | 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-26
|
* lavc/h264: replace MAX_MMCO_COUNT with H264_MAX_MMCO_COUNTAnton Khirnov2022-01-26
| | | | | | 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-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_parser: don't alter decoder private dataJames Almer2022-01-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_parser: Set AVCodecContext.framerateNicolas Gaullier2021-09-23
| | | | | 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-08
| | | | | | | | 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-20
| | | | | | | | | | | | | | 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-27
| | | | | | | 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-27
| | | | | | | 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-10
| | | | | | | | 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-10
| | | | | | | | | 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-25
| | | | | | | | | | 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-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_sei: remove redundant prefix to H264SEIFramePacking fieldsJames Almer2017-12-01
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* h2645_parse: Allocate a single buffer per packetKieran Kunhya2017-11-04
| | | | | Drastically reduces memory usage on pathological streams. Fixes ticket #6789
* 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)
* 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/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>
* lavc/h264_parser: export field order in more casesRodger Combs2016-10-24
|
* avcodec/h264_parser: fix for possible overflowPaul B Mahol2016-09-14
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/h264_parser: set missing pts for top/bottom field framesPaul B Mahol2016-09-14
| | | | | | Adopted from 4eb49fdde8f84d54a763cfb5d355527b525ee2bf revert. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/h264_parser: Factor get_avc_nalsize() outMichael Niedermayer2016-08-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>
* 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 'b24dafe10572254ff0decc18b0d7c3d3707d5a29'James Almer2016-08-01
|\| | | | | | | | | | | | | * commit 'b24dafe10572254ff0decc18b0d7c3d3707d5a29': lavc: drop unnecessary h264dec.h includes Merged-by: James Almer <jamrial@gmail.com>
| * lavc: drop unnecessary h264dec.h includesAnton Khirnov2016-06-21
| |
* | 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.
* | avcodec/h264_parser: Set sps/pps_refMichael Niedermayer2016-07-02
| | | | | | | | | | | | | | | | 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-30
| |
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-21
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-04
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | lavc/h264_ps: add ff_h264_ps_uninit and use itMatthieu Bouron2016-06-20
| |
* | lavc/h264_parser: replace AVCodecContext with logging ctx in scan_mmco_reset()Clément Bœsch2016-06-20
| |
* | lavc/h264: add a logging ctx to ff_h264_pred_weight_table()Clément Bœsch2016-06-20
| |
* | Merge commit '72da8d9bb24d1b1bf74c2f1108650c0da0054d2e'Clément Bœsch2016-06-19
|\| | | | | | | | | | | | | * 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-24
| |
* | lavc/h264: move history parsing variable to H264ParseContextClément Bœsch2016-06-19
| | | | | | | | This makes h264_find_frame_end() not depend on H264Context anymore.
* | lavc/h264_parser: pass logctx to h264_find_frame_end()Clément Bœsch2016-06-19
| | | | | | | | This helps removing the H264Context from the H264ParseContext.
* | Merge commit '98c97994c5b90bdae02accb155eeceeb5224b8ef'Clément Bœsch2016-06-19
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '98c97994c5b90bdae02accb155eeceeb5224b8ef': h264: decouple extradata parsing from the decoder Main changes: - move get_avc_nalsize() inside h264_parser.c and make it use H264ParseContext instead of H264Context. This helps fixing fate-flv-demux. - Also use is_avc/nal_length_size from the H264ParseContext in various places instead of the H264Context one as that's the fields now filled by ff_h264_decode_extradata() - h264_parse: dont fail decode_extradata_ps() due to nal split failure. Change by Michael to fix decoding of h264/ref_10.avi. Merged-by: Clément Bœsch <u@pkh.me> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
| * h264: decouple extradata parsing from the decoderAnton Khirnov2016-04-24
| | | | | | | | This will allow decoupling the parser from the decoder.
* | Merge commit '728d90a0c1973661a9e73da697bf4f90c9d19577'Clément Bœsch2016-06-18
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '728d90a0c1973661a9e73da697bf4f90c9d19577': h264: decouple h264_sei from the h264 decoder Main changes: - SEI decoding doesn't have access to the debug flag in the codec context so a few logging are dropped. - naming of quincunx_sampling_flag and frame_packing_arrangement_type are kept as they are in FFmpeg instead of respectively quincunx_subsampling and arrangement_type used in Libav because the former match the specifications. - don't reset the x264 build info once read in order to fix fate-h264-lossless (change by Hendrik) - H264Context.has_recovery_point and deprecated AVCodecContext.dtg_active_format are set after ff_h264_sei_decode() based on the SEI state since ff_h264_sei_decode() doesn't have access to H264Context anymore. - frame_packing_arrangement_type is not checked against <= 0 in decode_postinit() since it is always read as a positive value with get_bits(). This fixes a -Wtype-limits warning by GCC spotted by Michael. Side Notes: - tested that ffprobe on the file from ticket #3652 still returns 4 keyframes - tested that playback from ticket #3063 still works Merged-by: Clément Bœsch <clement@stupeflix.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * h264: decouple h264_sei from the h264 decoderAnton Khirnov2016-04-24
| | | | | | | | | | Make the SEI parsing independent of the H264Context, to allow decoupling the parser from the decoder.
* | Merge commit 'c8dcff0cdb17d0aa03ac729eba12d1a20f1f59c8'Clément Bœsch2016-06-12
|\| | | | | | | | | | | | | * commit 'c8dcff0cdb17d0aa03ac729eba12d1a20f1f59c8': h264: factor out calculating the POC count into a separate file Merged-by: Clément Bœsch <u@pkh.me>