1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

69 Commits

Author SHA1 Message Date
Andreas Rheinhardt
72c601e0f7 avutil/internal: Move avpriv-file API to a header of its own
It is not used by the large majority of files that include
lavu/internal.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-03 15:41:44 +02:00
Andreas Rheinhardt
40e6575aa3 all: Replace if (ARCH_FOO) checks by #if ARCH_FOO
This is more spec-compliant because it does not rely
on dead-code elimination by the compiler. Especially
MSVC has problems with this, as can be seen in
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html
or
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html

This commit does not eliminate every instance where we rely
on dead code elimination: It only tackles branching to
the initialization of arch-specific dsp code, not e.g. all
uses of CONFIG_ and HAVE_ checks. But maybe it is already
enough to compile FFmpeg with MSVC with whole-programm-optimizations
enabled (if one does not disable too many components).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:56:37 +02:00
Martin Storsjö
6076dbcb55 Switch uses of av_fopen_utf8 to avpriv_fopen_utf8
The former has been deprecated.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-05-23 13:52:45 +03:00
Paul B Mahol
452d611fc7 avfilter/vf_lut3d: allow to control when to upload CLUT for haldclut 2022-04-26 20:07:04 +02: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
Mark Reid
716b396740 avfilter/vf_lut3d: add x86-optimized tetrahedral interpolation
I spotted an interesting pattern that I didn't see before that leads to the implementation being faster.
The bit shifting table I was using before is no longer needed, and was able to remove quite a few lines. 
I also add use of FMA on the AVX2 version.

f32 1920x1080 1 thread with prelut
c impl
1434012700 UNITS in lut3d->interp,       1 runs,      0 skips
1434035335 UNITS in lut3d->interp,       2 runs,      0 skips
1423615347 UNITS in lut3d->interp,       4 runs,      0 skips
1426268863 UNITS in lut3d->interp,       8 runs,      0 skips

sse2
905484420 UNITS in lut3d->interp,       1 runs,      0 skips
905659010 UNITS in lut3d->interp,       2 runs,      0 skips
915167140 UNITS in lut3d->interp,       4 runs,      0 skips
915834222 UNITS in lut3d->interp,       8 runs,      0 skips

avx
574794860 UNITS in lut3d->interp,       1 runs,      0 skips
581035090 UNITS in lut3d->interp,       2 runs,      0 skips
584116720 UNITS in lut3d->interp,       4 runs,      0 skips
581460290 UNITS in lut3d->interp,       8 runs,      0 skips

avx2
301698880 UNITS in lut3d->interp,       1 runs,      0 skips
301982880 UNITS in lut3d->interp,       2 runs,      0 skips
306962430 UNITS in lut3d->interp,       4 runs,      0 skips
305472025 UNITS in lut3d->interp,       8 runs,      0 skips

gbrap16 1920x1080 1 thread with prelut
c impl
1480894840 UNITS in lut3d->interp,       1 runs,      0 skips
1502922990 UNITS in lut3d->interp,       2 runs,      0 skips
1496114307 UNITS in lut3d->interp,       4 runs,      0 skips
1492554551 UNITS in lut3d->interp,       8 runs,      0 skips

sse2
980777180 UNITS in lut3d->interp,       1 runs,      0 skips
986121520 UNITS in lut3d->interp,       2 runs,      0 skips
986489840 UNITS in lut3d->interp,       4 runs,      0 skips
998832248 UNITS in lut3d->interp,       8 runs,      0 skips

avx
622212360 UNITS in lut3d->interp,       1 runs,      0 skips
622981160 UNITS in lut3d->interp,       2 runs,      0 skips
645396315 UNITS in lut3d->interp,       4 runs,      0 skips
641057075 UNITS in lut3d->interp,       8 runs,      0 skips

avx2
321336400 UNITS in lut3d->interp,       1 runs,      0 skips
321268920 UNITS in lut3d->interp,       2 runs,      0 skips
323459895 UNITS in lut3d->interp,       4 runs,      0 skips
324949967 UNITS in lut3d->interp,       8 runs,      0 skips
2021-10-10 22:23:48 +02:00
Andreas Rheinhardt
31a373ce71 avfilter: Reindentation after query_formats changes
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-05 18:58:29 +02:00
Andreas Rheinhardt
2534386cff avfilter/vf_lut3d: Use formats list instead of query function
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-05 18:58:27 +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
5e9c7f1355 avfilter/vf_lut3d: Deduplicate options
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-23 21:12:58 +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
1b20853fb3 avfilter/internal: Factor out executing a filter's execute_func
The current way of doing it involves writing the ctx parameter twice.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-15 21:33:25 +02:00
Andreas Rheinhardt
18ec426a86 avfilter/formats: Factor common function combinations out
Several combinations of functions happen quite often in query_format
functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts))
is very common. This commit therefore adds functions that are equivalent
to commonly used function combinations in order to reduce code
duplication.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-13 17:36:22 +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
89f78dd0fe avfilter/vf_lut3d: lut3d, haldclut: add support for commands 2021-02-08 00:55:07 +01:00
Paul B Mahol
d8181cbbc4 avfilter/vf_lut3d: lut1d: add support for commands 2021-02-06 12:47:21 +01:00
Paul B Mahol
50dd020f04 avfilter/vf_lut3d: add prism interpolation 2021-01-29 23:41:07 +01:00
Paul B Mahol
26a53519dc avfilter/vf_lut3d: add pyramid interpolation 2021-01-29 23:41:07 +01:00
Mark Reid
e366797ad3 avfilter/vf_lut3d: fix sanitizef INF handling
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2020-11-20 15:20:24 +01:00
Mark Reid
5fcd83a244 avfilter/vf_lut3d: support remaping negative values in the prelut 2020-09-07 19:04:09 +02:00
Andreas Rheinhardt
317b722c51 avfilter/vf_lut3d: Fix mixed declaration and code
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-06-01 15:21:40 +02:00
Mark Reid
a1221b96d8 avfilter/vf_lut3d: prelut support for 3d cinespace luts
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-31 00:55:12 +02:00
Mark Reid
04f67dcccf avfilter/vf_lut3d: initial float pixel format support
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-23 00:26:38 +02:00
Paul B Mahol
a2c0746344 avfilter/vf_lut3d: use av_fopen_utf8() 2020-02-14 21:44:38 +01:00
Limin Wang
99fc5059fb avfilter/vf_lut3d: simplify code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-01 14:43:16 +01:00
Paul B Mahol
a2210f10d3 avfilter/vf_lut3d: increase max level to upper limit defined by cube format specification 2019-10-26 10:32:20 +02:00
Paul B Mahol
9130028d87 avfilter/vf_lut3d: allocate 3d lut dynamically 2019-10-26 10:32:20 +02:00
Paul B Mahol
5840a7f8a6 avfilter/vf_lut3d: increase MAX_LEVEL 2019-04-28 10:52:21 +02:00
Paul B Mahol
d5b2458f46 avfilter/vf_lut3d: fix range domain processing for .cube format
The ranges are for input, not for output.
2019-04-28 09:32:55 +02:00
Paul B Mahol
e20ad3bd59 avfilter/vf_lut3d: add cineSpace 3D lut support 2019-04-20 13:52:42 +02:00
Paul B Mahol
b9d25b1a6e avfilter/vf_lut3d: add cineSpace 1D lut parsing 2019-04-20 13:52:41 +02:00
Paul B Mahol
4902780d2b avfilter/vf_lut3d: use av_sscanf 2018-11-16 20:24:52 +01:00
Paul B Mahol
8860d30731 avfilter/vf_lut3d: ignore last whitespace when comparing LUT size string
In some situations it might be tab character and in others normal space.
2018-11-11 13:36:45 +01:00
Paul B Mahol
c47b48c0a6 avfilter/vf_lut3d: add spline 1D interpolation 2018-11-10 22:08:42 +01:00
Paul B Mahol
0bc2326b90 avfilter/vf_lut3d: add cosine 1D interpolation 2018-11-10 21:44:35 +01:00
Paul B Mahol
963c16ed38 avfilter/vf_lut3d: do not error out if TITLE is after other lines 2018-10-25 23:23:51 +02:00
Paul B Mahol
c4cda4eb87 avfilter: add lut1d filter 2018-09-07 21:44:03 +02:00
Paul B Mahol
af31084399 avfilter/vf_lut3d: unbreak haldclut with planar rgb formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-02 19:16:22 +02:00
Paul B Mahol
244d4ba0da avfilter/vf_lut3d: fix typo
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 23:17:53 +02:00
Paul B Mahol
901dc11bb6 avfilter/vf_lut3d: add planar rgb support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-04 21:27:48 +02:00
Carl Eugen Hoyos
5d3e935728 lavfi: Rename local variables "main" as "master".
Silences several warnings:
main is usually a function
2017-10-07 20:49:48 +02:00
Nicolas George
5f5dcf44e3 lavfi: rename framesync2 to framesync. 2017-09-12 11:03:51 +02:00
Nicolas George
eacb3ec961 lavfi/vf_lut3d: convert to framesync2. 2017-08-29 10:19:04 +02:00
Paul B Mahol
62c8dc4642 avfilter/vf_lut3d: actually skip lines when encountering DOMAIN_ string
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-03-13 15:30:05 +01:00
Paul B Mahol
a0a57072c9 avfilter: make use of ff_filter_get_nb_threads 2016-08-29 16:27:09 +02:00
Clément Bœsch
9f846ed4c7 avfilter/haldclut: use AV_OPT_TYPE_BOOL for shortest and repeatlast options 2015-09-09 00:30:53 +02:00
Clément Bœsch
8978052869 avfilter/lut3d: assert on pixel format descriptor
inlink->format is supposed to be set to a valid format controlled by query_formats().
2015-06-13 20:51:43 +02:00
Clément Bœsch
40cc3be73c avfilter: fix a few 5 spaces indent 2015-06-07 20:18:15 +02:00
Michael Niedermayer
fbb9ef5b17 avfilter/vf_lut3d: 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
Clément Bœsch
fd682b1892 avfilter: handle error in query_formats() of a bunch of random video filters 2015-03-16 23:43:12 +01:00