summaryrefslogtreecommitdiff
path: root/libavcodec/av1_metadata_bsf.c
Commit message (Collapse)AuthorAgeFilesLines
* lavc/{av1, h264, h265}_metadata_bsf: fix description of tick_rateZhao Zhili2022-01-011-1/+1
| | | | | | | | Users may take the description literally which leads to inverted results. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com> Reviewed-by: Jun Zhao <barryjzhao@tencent.com
* avcodec/av1_metadata: don't store the inserted TD OBU in stackJames Almer2021-04-231-7/+9
| | | | | | | | | Fixes: stack-use-after-return Fixes: clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-5931515701755904 Fixes: clusterfuzz-testcase-minimized-ffmpeg_BSF_AV1_METADATA_fuzzer-6105676541722624 Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1_metadata_bsf: Check for the existence of unitsAndreas Rheinhardt2021-04-021-1/+1
| | | | | | | Fixes a crash with ISOBMFF extradata containing no OBUs. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* av1_metadata_bsf: Use common cbs bsf implementationMark Thompson2021-01-211-155/+21
|
* avcodec/av1_metadata_bsf: Use separate contexts for reading/writingJames Almer2020-07-161-9/+14
| | | | | | Based on code from 235a5734e0 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cbs: Remove unused function parametersAndreas Rheinhardt2020-07-071-7/+7
| | | | | | | | Several cbs-functions had an unused CodedBitstreamContext parameter. This commit removes these. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec.h: split bitstream filters API into its own headerAnton Khirnov2020-05-221-0/+1
|
* lavc: rename bsf.h to bsf_internal.hAnton Khirnov2020-05-221-1/+1
| | | | This will allow adding a public header named bsf.h
* avcodec/av1_metadata: filter parameter sets in packet side dataJames Almer2020-05-031-0/+48
| | | | | | | | | | | | | | Extradata included in packet side data is meant to replace the codec context extradata. So when muxing for example to MP4 without this change and if extradata is present in a packet side data, the result will be that the parameter sets present in keyframes will be filtered, but the parameter sets ultimately included in the av1C box will not. This is especially important for AV1 as both currently supported encoders don't export the Sequence Header in the codec context extradata, but as packet side data instead. Signed-off-by: James Almer <jamrial@gmail.com>
* av1/h264_metadata: Don't reinitialize dataAndreas Rheinhardt2019-07-281-6/+1
| | | | | | | | | | If the relevant elements (the color description elements for AV1 and the VUI elements in general for H.264 (since 1156b507)) are absent, then their correct values (usually meaning unknown) have already been inferred by the reading process, so that it is unnecessary to initialize them again in the av1/h264_metadata filters even when they were initially absent. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* cbs: ff_cbs_delete_unit: Replace return value with assertAndreas Rheinhardt2019-07-081-7/+2
| | | | | | | | | | ff_cbs_delete_unit never fails if the index of the unit to delete is valid, as it is with all current callers of the function. So just assert in ff_cbs_delete_unit that the index is valid and change the return value to void in order to remove the callers' checks for whether ff_cbs_delete_unit failed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* av1_metadata: Error out if fragment is emptyAndreas Rheinhardt2019-07-071-0/+6
| | | | | | | | If the fragment is empty after parsing (i.e. it contains no OBUs), then the check for the type of the fragment's first OBU is nonsensical; so error out in this case just as h264_metadata and hevc_metadata do. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* av1/h264_metadata, filter_units: Count down when deleting unitsAndreas Rheinhardt2019-07-071-2/+1
| | | | | | | | | | | | | | When testing whether a particular unit should be kept or discarded, it is best to start at the very last unit of a fragment and count down, because that way a unit that will eventually be deleted won't be memmoved during earlier deletions; and frag/au->nb_units need only be evaluated once in this case and the counter is automatically correct when a unit got deleted. It also works for double loops, i.e. when looping over all SEI messages in all SEI units of an access unit. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* av1_metadata: Avoid allocations and copies of packet structuresAndreas Rheinhardt2019-07-071-11/+5
| | | | | | | | | | | This commit changes av1_metadata to (a) use ff_bsf_get_packet_ref instead of ff_bsf_get_packet (thereby avoiding one malloc and free per filtered packet) and (b) to use only one packet structure at all, thereby avoiding a call to av_packet_copy_props. (b) has been made possible by the recent changes to ff_cbs_write_packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/av1_metadata: add an option to remove Padding OBUsJames Almer2019-04-031-0/+19
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* libavcodec/cbs: Stop needlessly reallocating the units arrayAndreas Rheinhardt2019-02-251-2/+4
| | | | | | | | | | | | | | | | | Currently, a fragment's unit array is constantly reallocated during splitting of a packet. This commit changes this: One can keep the units array by distinguishing between the number of allocated and the number of valid units in the units array. The more units a packet is split into, the bigger the benefit. So MPEG-2 benefits the most; for a video coming from an NTSC-DVD (usually 32 units per frame) the average cost of cbs_insert_unit (for a single unit) went down from 6717 decicycles to 450 decicycles (based upon 10 runs with 4194304 runs each); if each packet consists of only one unit, it went down from 2425 to 448; for a H.264 video where most packets contain nine units, it went from 4431 to 450. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* av1_metadata: Fix constraint on setting chroma_sample_positionMark Thompson2018-10-061-6/+2
| | | | It can't be set for 4:2:2 streams.
* avcodec/av1_metadata: add an option to insert and remove Temporal Delimiter OBUsJames Almer2018-10-031-1/+36
| | | | | Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: Add AV1 metadata bitstream filterMark Thompson2018-09-261-0/+267
Can adjust colour and timing information.