aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_sei.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/h2645_sei: use the RefStruct API for film_grain_characteristicsJames Almer2024-11-111-1/+0
| | | | | | | And ensure the buffer is synced between threads. Based on a patch by Dale Curtis <dalecurtis@chromium.org> Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "avcodec/h2645: allocate film grain metadata dynamically"James Almer2024-11-111-0/+1
| | | | | | | | | | | | | AVFilmGrainAFGS1Params, the offending struct, is using sizeof(AVFilmGrainParams) when it should not. This change also forgot to make the necessary changes to the frame threading sync code. Both of these will be fixed by the following commit. H274FilmGrainDatabase will be handled later. This reverts commit 08b1bffa49715a9615acc025dfbea252d8409e1f. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h2645: allocate film grain metadata dynamicallyDale Curtis2024-10-251-1/+0
| | | | | | | | | | | | | Film grain support adds a huge amount of overhead to the H264Context structure for a feature that is rarely used. On low end devices or pages that have lots of media this bloats memory usage rapidly. This changes the static film grain metadata allocations to be dynamic which reduces the H264Context size from 851808 bytes to 53444 bytes. Bug: https://crbug.com/359358875 Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec/h264_ps: Use RefStruct API for SPS/PPSAndreas Rheinhardt2023-10-071-1/+1
| | | | | | | | | | | | | | 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>
* avcodec/h264_sei, sei: Make H264_SEI_FpaType genericAndreas Rheinhardt2022-12-011-7/+7
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h2645_sei: Factor out freeing common SEI partsAndreas Rheinhardt2022-12-011-5/+1
| | | | | | | | | | | This commit only factors out freeing the common SEI parts, not whether the fields indicating whether an SEI is present shall be reset. H.264 and HEVC differ in this regard (ff_h264_sei_uninit() really resets, whereas ff_hevc_reset_sei() only uninits.) and neither actually honours the persistency as prescribed by the relevant specs. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h2645_sei: Factor parsing common SEI messages outAndreas Rheinhardt2022-12-011-244/+15
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_sei: Don't use GetBit-API for byte-aligned readsAndreas Rheinhardt2022-12-011-76/+69
| | | | | | | SEI NALUs and several SEI messages are naturally byte-aligned, so reading them via the bytestream-API is more natural. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-241-1/+1
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/h264_sei: fix H.274 film grain parsingNiklas Haas2021-08-151-1/+1
| | | | | | | | | | The current code reads the wrong number of bits for `fg_model_id`, which causes all of the values downstream of this to contain corrupt values. Fixes: corrupt SEI values Fixes: 4ff73add5dbe6c319d693355be44df2e17a0b8bf Signed-off-by: Niklas Haas <git@haasn.dev>
* avcodec/h264_sei: honor the Film Grain Characteristics cancel flagJames Almer2021-07-251-2/+2
| | | | | | Film Grain persistence is cancelled when it's true. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: parse and export Film Grain Characteristics SEI messagesJames Almer2021-07-231-0/+47
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Remove/replace some unnecessary avcodec.h inclusionsAndreas Rheinhardt2021-07-221-2/+8
| | | | | | | Also remove other unnecessary headers and include headers directly while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* h264: Use common SEI typesMark Thompson2021-01-211-9/+9
|
* avcodec/h264_sei: print a log message when a unsupported ITU-T T35 SEI ↵James Almer2020-12-181-1/+11
| | | | | | messages is parsed Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: refactor parsing User Data Registered ITU-T T35 SEI messagesJames Almer2020-12-181-9/+25
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264_sei: use ff_parse_a53_cc() to parse A53 Closed CaptionsJames Almer2020-08-151-46/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h264: create user data unregistered SEI side data for H.264Limin Wang2020-06-151-3/+16
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* h264_sei: parse the picture timing SEIs correctlyAnton Khirnov2020-04-101-34/+48
| | | | | | | | | 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.
* h264_sei: use a separate reader for the individual SEI messagesAnton Khirnov2020-04-101-14/+19
| | | | | This tells the parsing functions the payload size and prevents them from overreading.
* avcodec/h264_sei: fix the size of user data unregisteredLimin Wang2019-12-201-3/+3
| | | | | | | According to the specifications, the payloadSize includes the 16-byte size of UUID. Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* h264/pic_timing: support multiple timecodesJosh de Kock2018-10-231-9/+12
|
* lavc/h264: create AVFrame side data from H.264 timecodesDevin Heitmueller2018-10-231-17/+20
| | | | | | | | | Create SMPTE ST 12-1 timecodes based on H.264 SEI picture timing info. For framerates > 30 FPS, the field flag is used in conjunction with pairs of frames which contain the same frame timestamp in S12M. Ensure the field is properly set per the spec.
* h264: Support multi-field closed captions by using AVBufferRef and not ↵Kieran Kunhya2018-08-171-7/+8
| | | | | | resetting per field Signed-off-by: Josh de Kock <joshdk@obe.tv>
* avcodec/h264_slice: Fix overflow in recovery_frame computationMichael Niedermayer2018-06-111-3/+9
| | | | | | | | Fixes: signed integer overflow: 15 + 2147483646 cannot be represented in type 'int' Fixes: 8381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6225533137321984 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-9/+9
| | | | | | Cosmetic change. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'James Almer2017-11-291-3/+4
|\ | | | | | | | | | | | | * 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-281-3/+4
| | | | | | | | | | | | 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-101-0/+11
| | | | | | | | | | | | | | | | | | | | 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>
| * h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-05-161-8/+8
| | | | | | | | | | This avoids confusion with equivalent H.265 SEI values when both are being used at the same time.
| * h264_sei: Check actual presence of picture timing SEI messageMichael Niedermayer2017-02-281-0/+3
| | | | | | | | | | 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-311-1/+1
| |
* | libavcodec/h264_sei: Don't log random user data. This prevents terminal junk.Kieran Kunhya2017-11-171-3/+0
| |
* | avcodec/h264_sei: add namespace prefix to frame packingarrangement enum valuesJames Almer2017-09-121-7/+7
| | | | | | | | | | | | Missed in 6eb102a616364d06a4cc994339b72910b3547e5f. Signed-off-by: James Almer <jamrial@gmail.com>
* | h264_sei: Add namespace prefix to all SEI valuesMark Thompson2017-09-121-10/+10
| | | | | | | | | | | | | | 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-101-0/+11
| | | | | | | | | | | | | | | | | | | | 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_sei: Check actual presence of SEI picture timing instead of ↵Michael Niedermayer2017-02-151-0/+3
| | | | | | | | | | | | implying it Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0'James Almer2016-08-011-1/+1
|\| | | | | | | | | | | | | * commit '1cf2f3d334f52849aae2be868bad1e5fa5f59aa0': h264_sei: drop an unnecessary h264dec.h include Merged-by: James Almer <jamrial@gmail.com>
| * h264_sei: drop an unnecessary h264dec.h includeAnton Khirnov2016-06-211-1/+1
| | | | | | | | | | The code does not depend on the h264 decoder anymore and only needs information from h264_ps
* | 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.
* | h264: make H264ParamSets sps constBenoit Fouet2016-06-301-2/+2
| |
* | avcodec/h264_sei: Do not skip subsequent SEIs on errors potentially caused ↵Michael Niedermayer2016-06-261-4/+10
| | | | | | | | | | | | by missing parameter sets. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-2/+2
|\| | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-2/+2
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '728d90a0c1973661a9e73da697bf4f90c9d19577'Clément Bœsch2016-06-181-171/+158
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-241-128/+138
| | | | | | | | | | Make the SEI parsing independent of the H264Context, to allow decoupling the parser from the decoder.
* | lavc/h264_sei: fix broken style around green metadata codeClément Bœsch2016-06-141-16/+14
| |
* | lavc/h264: rename GreenMetaData to H264SEIGreenMetaDataClément Bœsch2016-06-141-1/+1
| | | | | | | | Reduces diff for the next merge with Libav.
* | lavc/h264_sei: reduce scope of parameters for green meta decodeClément Bœsch2016-06-141-16/+16
| | | | | | | | | | This is again will help the merge as ff_h264_decode_sei will not have access to H264Context anymore.