Commit Graph

40 Commits

Author SHA1 Message Date
Paul B Mahol
cd4e6e404b avfilter/vf_extractplanes: fix regression
Report & solution provided by Andreas Rheinhardt.
2021-09-12 17:06:21 +02:00
Paul B Mahol
b35653d4c4 avfilter/vf_extractplanes: stop marking alphaextract filter as dynamic outputs 2021-09-12 13:50:01 +02:00
Andreas Rheinhardt
2142e71911 avfilter/vf_extractplanes: Free outpads' names generically
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-22 16:15:33 +02: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
515e7fbce1 avfilter/avfilter: Remove unused feature to add pads in the middle
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-17 21:20:59 +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
Paul B Mahol
629dd8efb5 avfilter/vf_extractplanes: add float formats support 2021-02-07 21:45:26 +01:00
Nicolas George
2f76476549 lavfi: regroup formats lists in a single structure.
It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
2020-09-08 14:02:40 +02:00
Gyan Doshi
f60fdbc960 avfilter/extractplanes: add support for 12-bit YUVA formats
At present, 16-bit auto-scaled format results in incorrect alpha
extraction.
2019-01-17 11:41:18 +01:00
Paul B Mahol
639694eaa5 avfilter/vf_extractplanes: use ff_outlink_get_status() 2018-11-03 18:24:19 +01:00
Paul B Mahol
e10846001d avfilter/vf_extractplanes: define higher depth formats with macro 2018-09-09 18:13:13 +02:00
Paul B Mahol
6c06389d6e avfilter/vf_extractplanes: define common 8-bit pixel formats 2018-09-09 18:06:22 +02:00
Paul B Mahol
43421386f2 avfilter/vf_extractplanes: fix 14bit format extraction 2018-09-09 17:56:43 +02:00
Paul B Mahol
41ebbae9dd avfilter/vf_extractplanes: add support for extracting planes with 14 depth
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-05 21:35:31 +02:00
Paul B Mahol
99dd47a647 avfilter/vf_extractplanes: check ff_insert_outpad() for failure
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-08-25 09:57:53 +02:00
Paul B Mahol
7bfbc2d787 avfilter/vf_extractplanes: add 9 bitdepth support 2017-08-07 13:09:56 +02:00
Paul B Mahol
ed93ed5ee3 avfilter: don't anonymously typedef structs
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-13 11:39:28 +02:00
Nicolas George
02aa0701ae lavfi: make filter_frame non-recursive.
A lot of changes happen at the same time:

- Add a framequeue fifo to AVFilterLink.

- split AVFilterLink.status into status_in and status_out: requires
  changes to the few filters and programs that use it directly
  (f_interleave, split, filtfmts).

- Add a field ready to AVFilterContext, marking when the filter is ready
  and its activation priority.

- Add flags to mark blocked links.

- Change ff_filter_frame() to enqueue the frame.

- Change all filtering functions to update the ready field and the
  blocked flags.

- Update ff_filter_graph_run_once() to use the ready field.

- buffersrc: always push the frame immediately.
2016-12-18 10:38:52 +01:00
Paul B Mahol
46752d6b12 avfilter/vf_extractplanes: add extract support for 10bit and 12bit formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-11-29 14:50:28 +01:00
Carl Eugen Hoyos
bba9bed3f3 lavfi/extractplanes: Add RGB0 and friends as supported pix_fmts. 2016-03-07 12:05:42 +01:00
Carl Eugen Hoyos
0ba844a053 lavfi/extractplanes: Fix in_pixfmts.
If the original pix_fmt was >8 bit and not supported by the filter,
the filter system could choose a pix_fmt with different endianness
as input for extractplanes which broke the output because the output
always used the endianness of the original pix_fmt.
2016-03-07 11:59:36 +01:00
Carl Eugen Hoyos
b872b98bb4 lavfi/extractplanes: Move endianness calculation up.
Needed for next commit.
2016-03-07 11:54:37 +01:00
Derek Buitenhuis
21f9468402 avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT
Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-27 16:36:46 +00:00
Nicolas George
108b4de552 lavfi: replace link.closed by link.status.
The status field can carry any error code instead of just EOF.
Also only update it through a wrapper function and provide a timestamp.
Update the few filters that used it directly.
2015-12-22 16:04:30 +01:00
Ganesh Ajjanagadde
6aaac24d72 avfilter/all: propagate errors of functions from avfilter/formats
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM).
This propagates the return values.

All of these were found by using av_warn_unused_result, demonstrating its utility.

Tested with FATE. I am least sure of the changes to avfilter/filtergraph,
since I don't know what/how reduce_format is intended to behave and how it should
react to errors.

Fixes: CID 1325680, 1325679, 1325678.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Previous version Reviewed-by: Nicolas George <george@nsup.org>
Previous version Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-14 10:04:01 -04:00
Hendrik Leppkes
5d8e836d0e Replace all remaining occurances of step/depth_minus1 and offset_plus1 2015-09-08 17:10:48 +02:00
Paul B Mahol
17e6d7b400 avfilter/vf_extractplanes: use faster path for input formats with only one component
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-01 17:19:52 +00:00
Paul B Mahol
fc40cdbf49 avfilter/vf_extractplanes: rename misleading variable
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-01 17:19:52 +00:00
Paul B Mahol
be35b8b9a9 avfilter/vf_extractplanes: support more pixel formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-01 17:19:52 +00:00
Paul B Mahol
f27cda48ec avfilter/vf_extractplanes: use the name 's' for the pointer to the private context
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-28 14:26:13 +00:00
Michael Niedermayer
325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Paul B Mahol
b890198b66 avfilter: add av_cold to init()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-27 18:51:49 +00:00
Michael Niedermayer
74cb7ef851 Merge commit 'b01f6041f4260fba053c2f96ce1611ea77e833a0'
* commit 'b01f6041f4260fba053c2f96ce1611ea77e833a0':
  lavfi: rename AVFilterFormats.format_count to nb_formats

Conflicts:
	libavfilter/avfiltergraph.c
	libavfilter/filtfmts.c
	libavfilter/formats.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-18 11:46:09 +02:00
Michael Niedermayer
c7c71f95f8 replace remaining PIX_FMT_* flags with AV_PIX_FMT_FLAG_*
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-15 11:23:14 +02:00
Clément Bœsch
50e66726a2 lavfi: use ceil right shift for chroma width/height.
This should fix several issues with odd dimensions inputs.

lut, vflip, pad and crop video filters also need to be checked for such
issues. It's possible sws is also affected.
2013-05-10 17:20:06 +02:00
Paul B Mahol
88e0e2054d lavfi: remove alphaextract special code
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-09 14:53:21 +00:00
Paul B Mahol
c4a5499d25 lavfi/extractplanes: packed rgb support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-08 19:28:30 +00:00
Paul B Mahol
1f2baec7bd lavfi: add gbrap support to some filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-08 12:48:05 +00:00
Michael Niedermayer
f4341c64be avfilter: add av_cold to uninit()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-06 16:55:06 +02:00
Paul B Mahol
ce322f4c19 extractplanes filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-03 16:30:39 +00:00