summaryrefslogtreecommitdiff
path: root/libavcodec/filter_units_bsf.c
Commit message (Collapse)AuthorAge
* avcodec/cbs: Remove unused function parametersAndreas Rheinhardt2020-07-07
| | | | | | | | 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-22
|
* lavc: rename bsf.h to bsf_internal.hAnton Khirnov2020-05-22
| | | | This will allow adding a public header named bsf.h
* av1/h264_metadata, filter_units: Count down when deleting unitsAndreas Rheinhardt2019-07-07
| | | | | | | | | | | | | | 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>
* filter_units: Avoid allocations and copies of packet structuresAndreas Rheinhardt2019-07-07
| | | | | | | | | | | | This commit changes filter_units 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 (or, in case of passthrough, to av_packet_move_ref). (b) has been made possible by the recent changes to ff_cbs_write_packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* filter_units: Reindent after previous commitAndreas Rheinhardt2019-07-07
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* filter_units: Don't use fake loopAndreas Rheinhardt2019-07-07
| | | | | | | | | | | | According to the BSF API, when a BSF is finished with an input packet, it should return AVERROR(EAGAIN) to signal that another packet should be sent to the BSF via av_bsf_send_packet that the actual BSF can receive via ff_bsf_get_packet[_ref]. filter_units on the other hand simply called ff_bsf_get_packet again if the first packet received didn't result in any output. This call of course returned AVERROR(EAGAIN) which was returned, but it is nevertheless better to not include a fake loop. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* filter_units: Unref packet on failureAndreas Rheinhardt2019-07-07
| | | | | | | According to the API, the packet structure a bsf receives must not be touched on failure, yet filter_units nevertheless did it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/cbs: Stop needlessly reallocating the units arrayAndreas Rheinhardt2019-02-25
| | | | | | | | | | | | | | | | | 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>
* filter_units, trace_headers: Always use fragment from contextAndreas Rheinhardt2019-02-25
| | | | | | | This is in preparation for another patch that will stop needless reallocations of the unit array. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* lavc: Add filter_units bitstream filterMark Thompson2018-03-18
This can remove units with types in or not in a given set from a stream. For example, it can be used to remove all non-VCL NAL units from an H.264 or H.265 stream.