Commit Graph

25 Commits

Author SHA1 Message Date
James Almer 1f96db959c avfilter: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
Andreas Rheinhardt c26730ed8f tests/dnn: Make DNN tests regular libavfilter tests
They test libavfilter internal API, so they should be libavfilter
test programs (which implies: linked statically to libavfilter
to access internal APIs and linked normally (statically or dynamically
depending upon the build configuration) against all the other libs).

Right now, they are always linked statically against all libs,
which is a significant size waste compared to shared libs as all
of libavcodec has been pulled in despite not being really used.
This also leads to linking failures on systems for which av_export_avutil
is intended: libavcodec does not expect to be linked statically
against the library providing avpriv_(cga|vga16)_font in this case.
This is fixed by this commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-19 00:46:29 +01:00
Andreas Rheinhardt 9a1547ba1e avfilter/tests/filtfmts: Check for existence of formats/channel layouts
Fixes segfaults with filters that either return AVERROR(EAGAIN)
(or another error) or that do not set everything and rely on
filter_query_formats() to set the rest.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-10 12:04:30 +02:00
Andreas Rheinhardt 2b72e693c7 avfilter/tests/filtfmts: Replace macro by ordinary function
This is possible now that AVFilterFormatsConfig exists.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-10 12:04:29 +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 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +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
Nicolas George beb98c0181 lavfi/tests/formats: reindent. 2020-05-23 15:50:20 +02:00
Nicolas George d5e5c6862b lavfi/formats: remove dead code.
Move the contents of all_channel_layouts.inc directly into
libavfilter/tests/formats.c.
2020-05-23 15:50:20 +02:00
Jun Zhao ff5ed7abd6 avfilter/tests/integral: Correct the comment
Correct the comment

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2019-02-13 19:59:39 +08:00
Jun Zhao 9f33b0ed39 avfilter/tests/integral: Fix build warning after adjust the location
Fix build warning like "warning: ISO C90 forbids mixed declarations
and code" after adjust the location for malloc fail check.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2019-02-12 09:09:29 +08:00
Jun Zhao 6382d03347 avfilter/tests/integral: Check malloc fail before using it
Need to check malloc fail before using it, so adjust the location
in the code.

Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2019-02-12 09:08:27 +08:00
Jun Zhao 74a7ddd985 lavfi/tests/filtfmts: fix the build warning.
fix the build warning: ignoring return value.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-05-10 19:28:51 +08:00
Clément Bœsch 5a71bce371 lavfi/nlmeans: add AArch64 SIMD for compute_safe_ssd_integral_image
ssd_integral_image_c: 49204.6
ssd_integral_image_neon: 28346.8
2018-05-08 10:28:06 +02:00
Josh de Kock 89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Carl Eugen Hoyos 3c14547eb7 lavfi/tests/filtfmts: Constify a variable.
Fixes the following warning:
libavfilter/tests/filtfmts.c: In function ‘main’:
libavfilter/tests/filtfmts.c:103:18: warning: assignment discards ‘const’ qualifier from pointer target type
2017-10-24 22:32:59 +02:00
Marton Balint 977fd88419 avfilter/formats: do not allow unknown layouts in ff_parse_channel_layout if nret is not set
Current code returned the number of channels as channel layout in that case,
and if nret is not set then unknown layouts are typically not supported.

Also use the common parsing code. Use a temporary workaround to parse an
unknown channel layout such as '13c', after a 1 year grace period only '13C'
will work.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-01-24 23:51:36 +01:00
Nicolas George e9ecada1d4 lavfi/tests/filtfmts: include internal.h. 2017-01-12 14:06:16 +01: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
Wan-Teh Chang dceac9a4a7 avfilter/tests/.gitignore: add integral
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-24 21:10:37 +01:00
Michael Niedermayer 1e34584814 avfilter/tests/integral: Remove unused variables
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-24 20:30:40 +02:00
Clément Bœsch c29b532a94 lavfi: add nlmeans filter
Fixes Ticket #4910
2016-09-24 09:52:10 +02:00
Clément Bœsch 5d48e4eafa Merge commit 'a6a750c7ef240b72ce01e9653343a0ddf247d196'
* commit 'a6a750c7ef240b72ce01e9653343a0ddf247d196':
  tests: Move all test programs to a subdirectory

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-22 13:44:34 +02:00
Diego Biurrun a6a750c7ef tests: Move all test programs to a subdirectory 2016-05-13 14:55:56 +02:00