Commit Graph

58 Commits

Author SHA1 Message Date
Anton Khirnov 1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Paul B Mahol bf23d530d2 avfilter/vf_histogram: call av_frame_copy_props() 2023-01-17 23:20:00 +01:00
Martin Storsjö a78f136f3f configure: Use a separate config_components.h header for $ALL_COMPONENTS
This avoids unnecessary rebuilds of most source files if only the
list of enabled components has changed, but not the other properties
of the build, set in config.h.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:12:49 +02:00
Paul B Mahol 148c030395 avfilter/vf_histogram: add more color modes 2021-10-27 11:29:29 +02:00
Paul B Mahol df05603291 avfilter/vf_histogram: add colors_mode option 2021-10-14 12:16:30 +02:00
Andreas Rheinhardt b4f5201967 avfilter: Replace query_formats callback with union of list and callback
If one looks at the many query_formats callbacks in existence,
one will immediately recognize that there is one type of default
callback for video and a slightly different default callback for
audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);"
for video with a filter-specific pix_fmts list. For audio, it is
the same with a filter-specific sample_fmts list together with
ff_set_common_all_samplerates() and ff_set_common_all_channel_counts().

This commit allows to remove the boilerplate query_formats callbacks
by replacing said callback with a union consisting the old callback
and pointers for pixel and sample format arrays. For the not uncommon
case in which these lists only contain a single entry (besides the
sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also
added to the union to store them directly in the AVFilter,
thereby avoiding a relocation.

The state of said union will be contained in a new, dedicated AVFilter
field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t
in order to create a hole for this new field; this is no problem, as
the maximum of all the nb_inputs is four; for nb_outputs it is only
two).

The state's default value coincides with the earlier default of
query_formats being unset, namely that the filter accepts all formats
(and also sample rates and channel counts/layouts for audio)
provided that these properties agree coincide for all inputs and
outputs.

By using different union members for audio and video filters
the type-unsafety of using the same functions for audio and video
lists will furthermore be more confined to formats.c than before.

When the new fields are used, they will also avoid allocations:
Currently something nearly equivalent to ff_default_query_formats()
is called after every successful call to a query_formats callback;
yet in the common case that the newly allocated AVFilterFormats
are not used at all (namely if there are no free links) these newly
allocated AVFilterFormats are freed again without ever being used.
Filters no longer using the callback will not exhibit this any more.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-05 17:48:25 +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 2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +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 85195f6ae9 avfilter/vf_histogram: add slide modes for thistogram 2020-09-26 22:04:27 +02: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
Paul B Mahol f651b18c19 avfilter/vf_histogram: add envelope to thistogram filter 2019-12-30 17:21:35 +01:00
Paul B Mahol 612b5791b8 avfilter/vf_histogram: add support for 12bit yuva formats 2019-12-29 15:33:55 +01:00
Paul B Mahol d3d6f5a76e avfilter/vf_histogram: reindent after previous commit 2019-12-29 15:33:55 +01:00
Paul B Mahol cc43c2f29a avfilter: add thistogram video filter 2019-12-29 15:33:55 +01:00
Paul B Mahol b5f0cea16c avfilter/vf_histogram: use the name 's' for the pointer to the private context
This is consistent across filters.
2019-12-26 20:45:20 +01:00
Paul B Mahol bac508fec1 avfilter: add support for GRAY9 and GBRAP10 2017-08-07 13:11:09 +02:00
Paul B Mahol 66be242626 avfilter/vf_histogram: actually add parade display mode
Rename previous parade mode to stack, what it really was from start.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-05-09 16:17:49 +02:00
Paul B Mahol c784b5cfdc avfilter/vf_histogram: set foreground alpha if possible in destination format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-10 00:28:28 +02:00
Paul B Mahol 0d8b6a15dd avfilter/vf_histogram: make foreground and background opacity configurable 2016-08-19 18:03:07 +02:00
Dave Rice 5d12cfacde avfilter/vf_histogram: indent histogram options 2016-06-11 18:40:55 +02:00
Dave Rice 91bc42528c avfilter/vf_histogram: shortcuts for histogram options 2016-06-11 18:40:48 +02:00
Paul B Mahol 02f8421546 avfilter/vf_histogram: add 12bit depth support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-03-06 19:55:02 +01:00
Paul B Mahol ac15d7a666 avfilter/vf_histogram: explicitly set 10bit output formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-03-04 23:09:41 +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
Ganesh Ajjanagadde ea2f04bffe lavfi/vf_histogram: replace round by lrint
lrint is at least as fast, uses a superior rounding mode, and avoids an
implicit cast.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-21 08:23:21 -08:00
Paul B Mahol cde75e3150 avfilter/vf_histogram: remove deprecated stuff
Remove all modes except levels mode.
Users should already switch to other filters with
extended funcionality: vectorscope and waveform.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-01 21:55:13 +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
Michael Niedermayer c97ea011f5 avfilter/vf_histogram: Fix order of operations with flags
Fixes CID1322325

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 23:02:03 +02:00
Paul B Mahol 9f2fa95bd8 avfilter/vf_histogram: 9 and 10 bit depth support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-08-28 14:15:17 +00:00
Paul B Mahol a16251a6d0 avfilter/vf_histogram: fix bug in checking pixel format flags
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-08-26 11:11:26 +00:00
Paul B Mahol 6be5b05fb1 avfilter/vf_histogram: levels: support more input pixel formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-08-23 10:13:52 +00:00
Paul B Mahol 14f97bb2bc avfilter: add waveform monitor filter 2015-08-22 19:48:42 +00:00
Paul B Mahol 4e8963fa38 avfilter: add video vectorscope filter 2015-08-20 22:57:47 +00:00
Paul B Mahol fa95965f5a avfilter/vf_histogram: make it possible to pick color components for levels mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-08-19 10:05:33 +00:00
Paul B Mahol a0854c084e avfilter: handle error in query_formats() in bunch of filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-04-08 13:05:06 +00:00
Michael Niedermayer 67e1562228 avfilter/vf_histogram: Change enum to int, which is accessed via AVOption as int
This fixes depending on implementation defined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-18 12:32:56 +01: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 a2c14ba2b1 avfilter/vf_histogram: use const for variables that are not supposed to change
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-10-04 16:48:19 +00:00
Marton Balint 0362cf1a19 avfilter/vf_histogram: add mirrored waveform mode
Added parameter to mirror the waveform (high values are shown on top in column mode)

Signed-off-by: Marton Balint <cus@passwd.hu>
2013-10-02 21:02:59 +00:00
Marton Balint 5b5bb0d81c avfilter/vf_histogram: fix segfault in parade waveform mode for subsampled formats
Signed-off-by: Marton Balint <cus@passwd.hu>
2013-10-02 21:02:54 +00:00
Paul B Mahol edadda968c avfilter/vf_histogram: change order of histograms for planar rgb
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-10-01 21:22:22 +00:00
Marton Balint cac9af68a4 avfilter/vf_histogram: add support for subsampled planar yuv modes in waveform mode
Signed-off-by: Marton Balint <cus@passwd.hu>
2013-10-01 21:04:31 +00:00
Marton Balint 31a8461d64 avfilter/vf_histogram: improve waveform speed
Signed-off-by: Marton Balint <cus@passwd.hu>
2013-10-01 21:04:30 +00:00
Paul B Mahol b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Paul B Mahol 68c4633fa8 lavfi/histogram: cache log2 of max_hval
Instead of calculating same value over and over again.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-19 14:30:42 +00:00
Paul B Mahol c45b823bf8 lavfi/histogram: logarithmic mode for levels
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-15 12:38:39 +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 7a2a421d73 vf_histogram: avoid floats, unbreak fate
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-15 21:44:50 +02:00