Commit Graph

15 Commits

Author SHA1 Message Date
Andreas Rheinhardt 19ffa2ff2d avfilter: Remove unnecessary formats.h inclusions
A filter needs formats.h iff it uses FILTER_QUERY_FUNC();
since lots of filters have been switched to use something
else than FILTER_QUERY_FUNC, they don't need it any more,
but removing this header has been forgotten.
This commit does this; files with formats.h inclusion went down
from 304 to 139 here (it were 449 before the preceding commit).

While just at it, also improve the other headers a bit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt 2f62a433f2 avfilter: Deduplicate default video inputs/outputs
Lots of video filters use a very simple input or output:
An array with a single AVFilterPad whose name is "default"
and whose type is AVMEDIA_TYPE_VIDEO; everything else is unset.

Given that we never use pointer equality for inputs or outputs*,
we can simply use a single AVFilterPad instead of dozens; this
even saves .data.rel.ro (8312B here) as well as relocations.

*: In fact, several filters (like the filters in vf_lut.c)
already use the same outputs; furthermore, ff_filter_alloc()
duplicates the input and output pads so that we do not even
work with the pads directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
Andreas Rheinhardt e72e8ec515 avfilter/vf_qp: Don't store NAN in int
Affected the filter-pp2 FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-11-09 17:39:00 +01:00
Anton Khirnov b9c928a486 avfilter: add AVFILTER_FLAG_METADATA_ONLY
This flag allows distinguishing between filters that actually modify the
data and those that only modify metadata or gather some stream
information.
2021-12-04 14:07:19 +01:00
Andreas Rheinhardt 8be701d9f7 avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
Up until now, an AVFilter's lists of input and output AVFilterPads
were terminated by a sentinel and the only way to get the length
of these lists was by using avfilter_pad_count(). This has two
drawbacks: first, sizeof(AVFilterPad) is not negligible
(i.e. 64B on 64bit systems); second, getting the size involves
a function call instead of just reading the data.

This commit therefore changes this. The sentinels are removed and new
private fields nb_inputs and nb_outputs are added to AVFilter that
contain the number of elements of the respective AVFilterPad array.

Given that AVFilter.(in|out)puts are the only arrays of zero-terminated
AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads
are not zero-terminated and they already have a size field) the argument
to avfilter_pad_count() is always one of these lists, so it just has to
find the filter the list belongs to and read said number. This is slower
than before, but a replacement function that just reads the internal numbers
that users are expected to switch to will be added soon; and furthermore,
avfilter_pad_count() is probably never called in hot loops anyway.

This saves about 49KiB from the binary; notice that these sentinels are
not in .bss despite being zeroed: they are in .data.rel.ro due to the
non-sentinels.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-20 12:53:58 +02:00
Andreas Rheinhardt a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Andreas Rheinhardt a91b18f368 avfilter/vf_qp: Deduplicate variable names arrays
This also avoids relocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-08 05:05:10 +01:00
Andreas Rheinhardt 2c6f532e0a Mark some pointers as const
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-01 15:25:48 +01:00
Anton Khirnov c72d526494 lavfi/vf_qp: convert to the video_enc_params API
Temporarily disable fate-filter-qp until vf_pp is converted.
2021-01-01 14:23:48 +01:00
Michael Niedermayer a79cbc0b8e avfilter/vf_qp: Fix use of uinitialized variable
Found-by: <Timothy_Gu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 22:54:13 +02:00
Michael Niedermayer 8f9a3817d5 avfilter/vf_qp: fix cleanup on error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 14:11:30 +02:00
Michael Niedermayer 2856634c67 vfilter/vf_qp: Support evaluating expression per MB
also add support for x/y/w/h parameters

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-28 15:18:58 +01:00
Michael Niedermayer a8fb8f6112 avfilter/vf_qp: split expression parsing out of loop
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-28 15:17:36 +01:00
Michael Niedermayer bdb3194217 avfilter/vf_qp: Fix leak of out_qp_table_buf
Fixes CID1270821

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-18 13:12:06 +01:00
Paul B Mahol baea14d860 avfilter: port qp filter from libmpcodecs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-14 18:46:38 +01:00