Commit Graph

10078 Commits

Author SHA1 Message Date
Jason Jang 18fceb9926 avfilter/af_apsyclip: fix peak overestimation
Ignore more samples that are near the edge of the block. The reason
is that the filtering tends to cause these samples to go above the
window more than the samples near the middle. If these samples are
included in the unwindowed peak estimation, the peak can be
overestimated. Because the block is windowed again before
overlapping, overshoots near the edge of the block are not very
important.

0.1 is the value from the version originally contributed to calf.

Signed-off-by: Jason Jang <jcj83429@gmail.com>
2022-02-05 14:52:16 +01:00
Jason Jang b4ad13420f avfilter/af_apsyclip: fix FFT bin indexing
With a complex FFT instead of real FFT, the negative frequencies
are not dropped from the spectrum output, so they need to be scaled
when the positive frequencies are scaled. The location of the top
bin is also different.

Signed-off-by: Jason Jang <jcj83429@gmail.com>
2022-02-05 14:52:16 +01:00
Paul B Mahol e13f0b9456 avfilter/vf_v360: improve xyz_to_fisheye() 2022-01-29 17:36:37 +01:00
Paul B Mahol 3981dbd192 avfilter/vf_v360: improve xyz_to_dfisheye() even more 2022-01-29 17:36:37 +01:00
Paul B Mahol d388dc20b9 avfilter/af_afir: switch to lavu/tx 2022-01-29 11:46:55 +01:00
Kyle Swanson 3d29724c00 avfilter/vf_libvmaf: update filter for libvmaf v2.0.0 2022-01-23 11:41:30 -08:00
Paul B Mahol 06a54a4ec7 avfilter/vf_v360: improve xyz_to_dfisheye() 2022-01-22 18:32:58 +01:00
Fei Wang a17c990265 avfilter/tonemap_vaapi: set va parameters filters and numbers
This can fill VAProcPipelineParameterBuffer correctly and make the
pipeline works.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-17 16:32:17 +08:00
Xinpeng Sun 516496069d avfilter: add overlay vaapi filter
Overlay one video on the top of another.

It takes two inputs and has one output. The first input is the "main" video on
which the second input is overlaid. This filter requires same memory layout for
all the inputs.

An example command to use this filter to overlay overlay.mp4 at the top-left
corner of the main.mp4:

ffmpeg -init_hw_device vaapi=foo:/dev/dri/renderD128 \
-hwaccel vaapi -hwaccel_device foo -hwaccel_output_format vaapi -c:v h264 -i main.mp4 \
-hwaccel vaapi -hwaccel_device foo -hwaccel_output_format vaapi -c:v h264 -i overlay.mp4 \
-filter_complex "[0:v][1:v]overlay_vaapi=0:0:100💯0.5[t1]" \
-map "[t1]" -an -c:v h264_vaapi -y out_vaapi.mp4

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Xinpeng Sun <xinpeng.sun@intel.com>
Signed-off-by: Zachary Zhou <zachary.zhou@intel.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-17 16:32:17 +08:00
Rudolf Polzer dcc9454ab9 vf_paletteuse: fix color cache lookup for Bayer dithering mode.
To trigger this bug, use `paletteuse=dither=bayer:bayer_scale=0`; you will see
that adjacent pixel lines will use the same dither pattern, instead of being
shifted from each other by 32 units (0x20).

One way to demostrate the bug is:

$ convert -size 64x256 gradient:black-white -rotate 270 grad.png
$ echo 'P2 2 1 255 0 255' > bw.pnm
$ ffmpeg -i grad.png -filter_complex 'movie=bw.pnm,scale=256x1[bw]; [0:v][bw]paletteuse=dither=bayer:bayer_scale=0' gradbw.png

Previously: https://www.rm.cloudns.org/img/uploaded/0bd152c11b9cd99e5945115534b1bdde.png
Now:        https://www.rm.cloudns.org/img/uploaded/89caaa5e36c38bc2c01755b30811f969.png

This was caused by passing inconsistent color vs (a,r,g,b) parameters to
color_get(), and NBITS being 5 meaning actually hitting the same cache node
does happen in this case, but ONLY if bayer_scale is zero.

The fix is passing the correct color value to color_get().

Also added a previous-failing FATE test; image comparison of the first frame:

Previously: https://www.rm.cloudns.org/img/uploaded/d0ff9db8d8a7d8a3b8b88bbe92bf5fed.png
Now:        https://www.rm.cloudns.org/img/uploaded/a72389707e719b5cd1c58916a9e79ca8.png

(on this less synthetic test image, the bug basically causes noise from cache
 hits vs misses)

Tested: FATE passes, which exercises this filter but at the default bayer_scale.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
2022-01-17 01:31:06 +05:30
Vittorio Giovara 7d377558a6 vf_tonemap: Fix order of planes
This resulted in a dimmed tonemapping due to bad resulting luma
calculation.

Found by: Derek Buitenhuis

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2022-01-14 15:48:36 +01:00
Linjie Fu 9c58fd2226 lavf/vf_deinterlace_vaapi: flush queued frame for field in DeinterlacingBob
For DeinterlacingBob mode with rate=field, the frame number of output
should equal 2x input total since only intra deinterlace is used.

Currently for "backward_ref = 0, rate = field", extra_delay is
introduced. Due to the async without flush, frame number of output is
[expected_number - 2].

Specifically, if the input only has 1 frame, the output will be empty.

Add deint_vaapi_request_frame for deinterlace_vaapi, send NULL frame
to flush the queued frame.

For 1 frame input in Bob mode with rate=field,
before patch: 0 frame;
after  patch: 2 frames;

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128
        -hwaccel_output_format vaapi -i input.h264 -an -vf
        deinterlace_vaapi=mode=bob:rate=field -f null -

Tested-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-12 10:02:24 +08:00
Niklas Haas ecf09764dc lavfi/vf_libplacebo: fix side data stripping logic
This was accidentally comparing s->colorspace against out->colorspace,
which is wrong - the intent was to compare in->colorspace against
out->colorspace.

We also forgot to strip mastering metadata. Finally, the order is sort
of wrong - we should strip this side data *before* process_frames,
because otherwise it may end up being seen and used by libplacebo.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-01-10 09:11:02 +01:00
softworkz 479f3c6598 avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11)
Commit 8b83dad825 introduced a
regression in a way that scaling via vpp_qsv doesn't work any longer
for devices with an MSDK runtime version lower than 1.19. This is true
for older CPUs which are stuck at 1.11.
The commit added checks for the compile-sdk version but it didn't test
for the runtime version.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-10 14:54:36 +08:00
Wu Jianhua 9a194252c7 avfilter: add a blend_vulkan filter
This commit adds a blend_vulkan filter and a normal blend mode, and
reserves support for introducing the blend modes in the future.

Use the commands below to test: (href: https://trac.ffmpeg.org/wiki/Blend)
I. make an image for test
ffmpeg -f lavfi -i color=s=256x256,geq=r='H-1-Y':g='H-1-Y':b='H-1-Y' -frames 1 \
-y -pix_fmt yuv420p test.jpg

II. blend in sw
ffmpeg -i test.jpg -vf "split[a][b];[b]transpose[b];[a][b]blend=all_mode=normal,\
pseudocolor=preset=turbo" -y normal_sw.jpg

III. blend in vulkan
ffmpeg -init_hw_device vulkan -i test.jpg -vf "split[a][b];[b]transpose[b];\
[a]hwupload[a];[b]hwupload[b];[a][b]blend_vulkan=all_mode=normal,hwdownload,\
format=yuv420p,pseudocolor=preset=turbo" -y normal_vulkan.jpg

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 15:16:22 +01:00
Wu Jianhua 49250b582a avfilter/vf_blend: fix un-checked potential memory allocation failure
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 15:16:22 +01:00
Niklas Haas db28bb8fb4 lavfi/libplacebo: support dovi metadata application
libplacebo supports automatic dolby vision application, but it requires
us to switch to a new API. Also add some logic to strip the dolby vision
metadata from the output frames in any case where we end up changing the
colorimetry.

The libplacebo dependency bump is justified because neither 184 nor 192
are part of any stable libplacebo release, so users have to build from
git anyways for this filter to exist.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-01-05 03:13:12 +01:00
rcombs da92865b27 lavfi/drawutils: re-enable P010 and P016 support
These formats now work as expected.
2022-01-04 19:39:22 -06:00
rcombs 66343e46cf lavfi/drawutils: overhaul to improve pixel format support
- No longer mixes u8 and u16 component accesses (this was UB)
- De-duplicated 8->16 conversion
- De-duplicated component -> plane+offset conversion
- De-duplicated planar + packed RGB
- No longer calls ff_fill_rgba_map
- Removed redundant comp_mask data member
- RGB0 and related formats no longer write an alpha value to the 0 byte
- Non-planar YA formats now work correctly
- High-bit-depth semi-planar YUV now works correctly
2022-01-04 19:39:22 -06:00
rcombs f67bd3a825 lavfi/drawutils: ensure we don't support formats with non-pixel-sized offsets 2022-01-04 19:39:22 -06:00
rcombs f320722eb5 lavfi/drawutils: ensure we can't overflow a component 2022-01-04 19:39:22 -06:00
rcombs f00079b25c lavfi/drawutils: ensure we don't allow mixed-byte-depth formats
These could be hazardous because of FFDrawColor's union
2022-01-04 19:39:22 -06:00
rcombs e24b71add5 lavfi/drawutils: reimplement ff_fill_rgba_map without hardcoding the list
Same outputs, but computed instead of statically known, so new formats will be
supported more easily. Asserts in place to ensure we update this if we add
anything incompatible with its logic.
2022-01-04 19:39:22 -06:00
rcombs 5018103fa3 lavfi/drawutils: reject shift-packed formats
Disables x2bgr10/x2rgb10 (which did not behave correctly before).
2022-01-04 19:39:22 -06:00
rcombs 186e931f74 lavfi/drawutils: remove redundant BE format checks
We already explicitly don't support big-endian in general
2022-01-04 19:39:22 -06:00
rcombs 52fe11ef34 lavfi/drawutils: move BE check out of loop 2022-01-04 19:39:22 -06:00
Andreas Rheinhardt ab54956edd configure: Add new mpegvideodec CONFIG_EXTRA
This allows to remove the spurious dependencies of mpegvideo encoders
on error_resilience; some other components that do not use mpegvideo
to its fullest turned out to not need it either.

Adding a new CONFIG_EXTRA needs a reconfigure to take effect.
In order to force this a few unnecessary headers from lavfi/allfilters.c
have been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Niklas Haas 10e4b2b1d2 lavfi/showinfo: fix printf precision for dovi metadata
Fix warning caused by this field changing from uint64_t to uint16_t.

Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 14:42:51 +01:00
Andreas Rheinhardt b189550137 lib*/version.h: Bump Versions after release/5.0 branch
This is done a second time for 5.0 because master was
merged into 5.0 so that it contains the recent DOVI additions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 14:29:06 +01:00
Andreas Rheinhardt c512be9a90 lib*/version.h: Bump Versions before release/5.0 branch
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 13:40:03 +01:00
Niklas Haas fc40f45b9c lavfi/showinfo: Support AV_FRAME_DATA_DOVI_METADATA
Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 11:59:41 +01:00
Andreas Rheinhardt 20b0d24c2f Makefile: Redo duplicating object files in shared builds
In case of shared builds, some object files containing tables
are currently duplicated into other libraries: log2_tab.c,
golomb.c, reverse.c. The check for whether this is duplicated
is simply whether CONFIG_SHARED is true. Yet this is crude:
E.g. libavdevice includes reverse.c for shared builds, but only
needs it for the decklink input device, which given that decklink
is not enabled by default will be unused in most libavdevice.so.

This commit changes this by making it more explicit about what
to duplicate from other libraries. To do this, two new Makefile
variables were added: SHLIBOBJS and STLIBOBJS. SHLIBOBJS contains
the objects that are duplicated from other libraries in case of
shared builds; STLIBOBJS contains stuff that a library has to
provide for other libraries in case of static builds. These new
variables provide a way to enable/disable with a finer granularity
than just whether shared builds are enabled or not. E.g. lavd's
Makefile now contains: SHLIBOBJS-$(CONFIG_DECKLINK_INDEV) += reverse.o

Another example is provided by the golomb tables. These are provided
by lavc for static builds, even if one uses a build configuration
that makes only lavf use them. Therefore lavc's Makefile contains
STLIBOBJS-$(CONFIG_MXF_MUXER) += golomb.o, whereas lavf's Makefile
has a corresponding SHLIBOBJS-$(CONFIG_MXF_MUXER) += golomb_tab.o.
E.g. in case the MXF muxer is the only component needing these tables
only libavformat.so will contain them for shared builds; currently
libavcodec.so does so, too.
(There is currently a CONFIG_EXTRA group for golomb. But actually
one would need two groups (golomb_avcodec and golomb_avformat) in
order to know when and where to include these tables. Therefore
this commit uses a Makefile-based approach for this and stops
using these groups for the users in libavformat.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 05:01:04 +01:00
Michael Niedermayer 4be85c9331 lib*/version.h: Bump Versions after release/5.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-01-03 22:10:46 +01:00
Michael Niedermayer f3964a59e1 lib*/version.h: Bump Versions before release/5.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-01-03 22:08:31 +01:00
Wu Jianhua 68d0a7e446 avfilter/vf_scale_vulkan: align struct ScaleVulkanContext
On 64 bit Operating System, sizeof(ScaleVulkanContext):
    reduce from 2400 to 2392 on Linux
    reduce from 2416 to 2408 on Windows

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-03 03:17:43 +01:00
Wu Jianhua c7c37a8f22 transpose_vulkan: add passthrough option
The following command is on how to apply passthrough option:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,transpose_vulkan=passthrough=landscape,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-03 03:17:43 +01:00
Paul B Mahol 209488ccb0 avfilter: add anlmf filter 2021-12-25 11:32:41 +01:00
rcombs 8e24a8e93a lavfi/metal: fix build with pre-10.11 deployment targets
- Ensure the yadif .metal compiles when targeting any Metal runtime version
- Use some preprocessor awkwardness to ensure Core Video's Metal-specific
  functionality is exposed regardless of our deployment target (this works
  around what seems to be an SDK header bug, filed as FB9816002)
- Ensure all direct references to Metal functions and classes are gated
  behind runtime version checks (this satisfies clang's deployment-target
  violation warnings provided by -Wunguarded-availability).
2021-12-22 18:43:34 -06:00
rcombs 0f77ee9d97 lavfi/metal: fix build on pre-10.15 SDKs 2021-12-22 18:43:34 -06:00
rcombs 2d16182e7d lavfi/metal: don't use braced-include for internal headers 2021-12-22 18:43:34 -06: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
Aman Karmani 4ac869ca2a avfilter: add vf_yadif_videotoolbox
deinterlaces CVPixelBuffers, i.e. AV_PIX_FMT_VIDEOTOOLBOX frames

for example, an interlaced mpeg2 video can be decoded by avcodec,
uploaded into a CVPixelBuffer, deinterlaced by Metal, and then
encoded to h264 by VideoToolbox as follows:

    ffmpeg \
           -init_hw_device videotoolbox \
           -i interlaced.ts \
           -vf hwupload,yadif_videotoolbox \
           -c:v h264_videotoolbox \
           -b:v 2000k \
           -c:a copy \
           -y progressive.ts

(note that uploading AVFrame into CVPixelBuffer via hwupload
 requires 504c60660d)

this work is sponsored by Fancy Bits LLC

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-12-18 11:57:31 -08:00
Aman Karmani ecee6af8bd avfilter: add metal utilities
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-12-18 11:55:47 -08:00
Aman Karmani ad3c19dc9e avfilter/vf_yadif_cuda: simplify filter definition
Signed-off-by: Aman Karmani <aman@tmm1.net>
Signed-off-by: Philip Langdale <philipl@overt.org>
2021-12-18 11:55:47 -08:00
Niklas Haas e9ba40c5c9 lavfi/vf_libplacebo: update deprecated option name
This was renamed upstream quite a while ago (v3.112.0). Rename the
option name as well for consistency (and expand the description just
slightly).

Signed-off-by: Niklas Haas <git@haasn.dev>
2021-12-15 23:38:29 +01:00
Niklas Haas 5317a6366f vf_libplacebo: switch to newer libplacebo helpers
Support for mapping/unmapping hardware frames has been added into
libplacebo itself, so we can scrap this code in favor of using the new
functions. This has the additional benefit of being forwards-compatible
as support for more complicated frame-related state management is added
to libplacebo (e.g. mapping dolby vision metadata).

It's worth pointing out that, technically, this would also allow
`vf_libplacebo` to accept, practically unmodified, other frame types
(e.g. vaapi or drm), or even software input formats. (Although we still
need a vulkan *device* to be available)

To keep things simple, though, retain the current restriction to vulkan
frames. It's possible we could rethink this in a future commit, but for
now I don't want to introduce any more potentially breaking changes.
2021-12-15 23:38:21 +01:00
Limin Wang 571e8ca2dd avfilter/af_astats: improve options descriptions
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-14 22:36:50 +08:00
Paul B Mahol 996b13fac4 avfilter: add audio dynamic equalizer filter 2021-12-12 10:47:28 +01:00
Wu Jianhua f176669a37 avfilter/vf_transpose_vulkan: simplify config_props_output function
It's no need to assign outlink here, which has been done in
ff_vk_filter_config_output already.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-10 20:50:13 +01:00
Wu Jianhua f106c72285 avfilter/vf_transpose_vulkan: add clock and cclock option
The following command is on how to apply cclock option:

ffmpeg -init_hw_device vulkan -i input.264 -vf \
hwupload=extra_hw_frames=16,transpose_vulkan=dir=cclock,hwdownload,format=yuv420p \
output.264

The following command is on how to apply clock_flip option:

ffmpeg -init_hw_device vulkan -i input.264 -vf \
hwupload=extra_hw_frames=16,transpose_vulkan=dir=clock_flip,hwdownload,format=yuv420p \
output.264

The following command is on how to apply clock option:

ffmpeg -init_hw_device vulkan -i input.264 -vf \
hwupload=extra_hw_frames=16,transpose_vulkan=dir=clock,hwdownload,format=yuv420p \
output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-10 20:49:51 +01:00
Wu Jianhua 58816f6927 avfilter: add a transpose_vulkan filter
The following command is on how to apply transpose_vulkan filter:
ffmpeg -init_hw_device vulkan -i input.264 -vf \
hwupload=extra_hw_frames=16,transpose_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-10 16:48:20 +01:00
Wu Jianhua ceeff7ae8d avfilter/vf_transpose: fix un-checked potential memory allocation failure
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-10 12:38:43 +01:00
Anton Khirnov 177a328c7c lavfi/vf_subtitles: stop using deprecated ass_set_aspect_ratio()
It has been deprecated in favor of ass_set_pixel_aspect() since version
0.11.0, roughly ~2014. Even Debian oldoldstable (stretch) has 0.13.
2021-12-07 11:16:14 +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
Anton Khirnov 944c34a94c lavfi/allfilters: move vf_chromaber_vulkan to video section 2021-12-04 14:06:42 +01:00
Andreas Rheinhardt 03ab1de429 avfilter/buffersink: Remove outdated comments
These lists have size fields since
e48ded8551.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 17:01:45 +01:00
Andreas Rheinhardt 01d158d1c8 all: Remove unused-but-set variables
Newer versions of Clang detect this and emit warnings for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:09:14 +01:00
Wu Jianhua bdfb0e4da4 avfilter: add a flip_vulkan filter
This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-02 11:06:24 +01:00
Paul B Mahol fc9a686688 avfilter: add audio dynamic smooth filter 2021-12-02 09:39:27 +01:00
Paul B Mahol 11b11577fe avfilter: add audio spectral stats filter 2021-12-02 09:35:36 +01:00
Limin Wang 86a2123a6e avfilter/src_movie: add format_opts for the opened file
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-29 09:26:40 +08:00
Andreas Rheinhardt f5e74e8d48 avfilter/vf_paletteuse: Add missing parentheses
Fixes a mistake in dea673d0d5.
GCC emitted a -Wint-in-bool-context warning because of that.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-27 19:15:19 +01:00
Paul B Mahol e38551180e avfilter/af_biquads: add svf transform type 2021-11-26 00:55:32 +01:00
Andreas Rheinhardt 01923579f4 avfilter/vf_huesaturation: Remove dead store
Fixes Coverity issue #1493345.

Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-19 20:37:17 +01:00
Wu Jianhua 3188b606d7 avfilter: add a vflip_vulkan filter
The following command is on how to apply vflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,vflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:48 +01:00
Wu Jianhua d313cb5a2f avfilter: add a hflip_vulkan filter
The following command is on how to apply hflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:48 +01:00
Wu Jianhua 999048b6b1 avfilter/overlay_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 067da5c87e avfilter/scale_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 404a58d5be avfilter/scale_vulkan: call av_pix_fmt_count_planes only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 6e4efe439f avfilter/chromaber_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 9f2b204461 avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 14f78d6234 avfilter/overlay_vulkan: use FF_ARRAY_ELEMS instead of magic number
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 8763bdc8cf avfilter/scale_vulkan: use FF_ARRAY_ELEMS instead of magic number
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 766b1c170b avfilter/chromaber_vulkan: use FF_ARRAY_ELEMS instead of magic number
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua 6a2284711e avfilter/avgblur_vulkan: use FF_ARRAY_ELEMS instead of magic number
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Wu Jianhua a1d1663458 avfilter/avgblur_vulkan: check if shader is created with success
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:47 +01:00
Lynne 1d06084171
vulkan: fix checkheaders 2021-11-19 16:47:28 +01:00
Lynne f6dd30df24
lavfi/vulkan: split off lavfi-specific code into vulkan_filter.c
The issue is that libavfilter depends on libavcodec, and when doing a
static build, if libavcodec also includes "libavfilter/vulkan.c", then
during link-time, compiling programs will fail as there would be multiple
definitions of the same symbols in both libavfilter and libavcodec's
object files.
Linkers are, however, more permitting if both files that include
a common file that's used as a template are one-to-one identical.
Hence, to make both files the same in the future, export all avfilter
specific functions to a separate file.
There is some work in progress to make templated files like this be
compiled only once, so this is not a long-term solution.

This also removes a macro that could be used to toggle SPIRV compilation
capability on #include-time, as this could cause the files to be different.
2021-11-19 16:47:26 +01:00
Lynne b2aec70bd6
lavu/vulkan: add option to switch between shader compilers and cleanup glslang 2021-11-19 13:44:47 +01:00
Lynne d1133e8c44
lavu/vulkan: move common Vulkan code from libavfilter to libavutil 2021-11-19 13:44:45 +01:00
Paul B Mahol 8c150d3d97 avfilter/af_drmeter: improve measurement precision 2021-11-18 22:23:28 +01:00
Paul B Mahol 2f472d5d65 avfilter/af_drmeter: refactor number of bins out 2021-11-18 22:23:28 +01:00
Limin Wang be43eacb7e avfilter/vf_gblur_vulkan: Fix use of uninitialized value
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-17 06:56:29 +01:00
Wu Jianhua e95969c07e avfilter/gblur_vulkan: fix memory leak
Whether failed or not, the block of codes labeled with fail should
be always run to ensure the av_free(kernel_def) is executed.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-17 04:24:33 +01:00
Paul B Mahol d401b1ccec avfilter: add colorspectrum source video filter 2021-11-16 20:41:39 +01:00
Lynne 20c66fe2f9
lavfi/vulkan: fix issues the previous commit introduced
One typo and one think-before-you-paste.
2021-11-16 11:20:13 +01:00
Lynne 8af7bcb6c3
lavfi/vulkan: add mutliqueue emulation code
This helps with testing multiple queues when the hardware only
has a single queue.
2021-11-16 10:32:37 +01:00
Lynne 8f9888a8d4
lavfi/vulkan: fix static descriptor set updating
Update all descriptor sets for all queues if a descriptor set hasn't
been initialized yet.
2021-11-16 10:32:35 +01:00
Wu Jianhua 5fc935c7fa libavfilter: add a gblur_vulkan filter
This commit adds a powerful and customizable gblur Vulkan filter,
which provides a maximum 127x127 kernel size of Gaussian Filter.
The size could be adjusted by requirements on quality or performance.

The following command is on how to apply gblur_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,gblur_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-16 10:32:21 +01:00
Paul B Mahol a7dfa6b446 avfilter/v360: add support for off-axis projection output 2021-11-15 20:41:27 +01:00
Anton Khirnov db932241ee */version.h: define FF_API macros unconditionally
There is no reason to wrap them in #ifndef guards, they should only be
defined here and nowhere else. The define guards just add the
possibility to accidentally use the same FF_API name in different
libraries.
2021-11-15 16:24:58 +01:00
Marton Balint 0a9edac48e avfilter/af_apad: do not add infinite silence for zero pad_dur or whole_dur
Unfortunately pad_len and pad_dur behaviour was different if 0 was specified,
pad_dur handled 0 duration as infinity, for pad_len, infinity was -1.

Let's make the behaviour consistent by handling 0 duration for pad_dur and
whole_dur as indeed 0 duration. This somewhat changes the behaviour of the
filter if 0 was explicitly specified, but deprecating the old option and adding
a new for the corrected behaviour seemed a bit overkill. So let's document the
change instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-14 18:13:58 +01:00
Niklas Haas a943f527a1 lavfi/vf_libplacebo: pick log level dynamically
In particular, allows users to go all the way up to PL_LOG_TRACE if
desired. (While also avoiding some potentially unnecessary callbacks for
filtered messages, including e.g. the CPU cost of printing out shader
sources)

Response to runtime log level changes by updating it once per
filter_frame(), which should hopefully be often enough.
2021-11-12 22:00:14 +01:00
Niklas Haas 51e03409d7 lavfi: add a libplacebo filter
This filter conceptually maps the libplacebo `pl_renderer` API into
libavfilter, which is a high-level image rendering API designed to work
with an RGB pipeline internally. As such, there's no way to avoid e.g.
chroma interpolation with this filter, although new versions of
libplacebo support outputting back to subsampled YCbCr after processing
is done.

That being said, `pl_renderer` supports automatic integration of the
majority of libplacebo's shaders, ranging from debanding to tone
mapping, and also supports loading custom mpv-style user shaders, making
this API a natural candidate for getting a lot of functionality out of
relatively little code.

In the future, I may approach this problem either by rewriting this
filter to also support a non-renderer codepath, or by upgrading
libplacebo's renderer to support a full YCbCr pipeline.

This unfortunately requires a very new version of libplacebo (unreleased
at time of writing) for timeline semaphore support. But the amount of
boilerplate needed to hack in backwards compatibility would have been
very unreasonable.
2021-11-12 14:45:36 +01:00
Limin Wang ec6187b05b avfilter/src_movie: make the number of decode thread configurable
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-12 17:23:01 +08:00
Lynne f705e9ea05
lavfi/vulkan: refactor, fix and fully implement multiple queues 2021-11-12 05:23:41 +01:00
Lynne 246f841b53
lavfi/glslang: migrate to the C API and robustify library detection
Finally, this is as close to usable as it gets for glslang.
Much faster to compile as well, and eliminates the need for a C++
compiler, which is great.
Also, changes to the resource limits won't break users, as we
can use designated initializers in C90.
2021-11-12 05:23:41 +01:00
Lynne fef85c376a
lavfi/vulkan: use libavutil's vulkan loader
This finally fully eliminates the need to statically link to libvulkan!
2021-11-12 05:23:40 +01:00
Lynne 6bf9a6539e
vulkan: add support for encode and decode queues and refactor queue code
This simplifies and makes queue family picking simpler and more robust.
The requirements on the device context are relaxed. They made no sense
in the first place.

The video encode/decode extension is still in beta, at least on paper,
but I really doubt they'd change needing a separate queue family.
2021-11-12 05:23:36 +01:00
Lynne dfc61800a2
lavfi/vulkan: port to using timeline semaphores 2021-11-12 03:36:46 +01:00
Paul B Mahol 047c362d3c avfilter/vf_nlmeans: add x86 SIMD 2021-11-11 21:54:46 +01:00
Paul B Mahol aebdffb9c5 avfilter/vf_estdif: allow to change two more options 2021-11-11 21:54:40 +01:00
Limin Wang afcf226b33 avfilter/af_atilt: use ff_filter_execute()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-11 21:54:17 +01:00
Paul B Mahol a13646639f avfilter/vf_estdif: do some clip calculations only once in loop 2021-11-09 09:49:40 +01:00
Paul B Mahol dcf83fd59d avfilter/vf_estdif: export distance cost as filter option 2021-11-09 09:49:39 +01:00
Paul B Mahol 45dc668aea avfilter/f_reverse: readjust frame timestamps for areverse 2021-11-07 20:47:21 +01:00
Paul B Mahol 0370c3e3d4 avfilter/af_adelay: use outlink where applicable 2021-11-07 20:47:21 +01:00
Roman Arzumanyan 08a501946f avfilter/scale_npp: add scale2ref_npp filter
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-11-03 19:06:14 +01:00
Paul B Mahol bf9950446d avfilter/vf_chromanr: improve filtering results 2021-11-03 11:55:46 +01:00
Paul B Mahol 8164fe1139 avfilter: add huesaturation filter 2021-10-29 23:18:27 +02:00
Paul B Mahol 2b6d290fbf avfilter/vf_nlmeans: split wa struct
This will make x86 SIMD simpler and faster.
2021-10-29 18:42:29 +02:00
Paul B Mahol eaca36d495 avfilter/vf_nlmeans: refactor line processing in preparation for x86 SIMD assembly 2021-10-29 18:42:29 +02:00
Paul B Mahol 38c86e7a02 avfilter/vf_nlmeans: avoid if () to help paralellization 2021-10-29 18:42:29 +02:00
Paul B Mahol 64d19411eb avfilter/vf_nlmeans: no need to print filter options at info level 2021-10-29 18:42:29 +02:00
Paul B Mahol 959ec353ce avfilter/vf_nlmeans: make access to pointer to lut faster 2021-10-29 18:42:29 +02:00
Paul B Mahol 81380d221c avfilter/vf_nlmeans: reduce scope of some variables 2021-10-29 18:42:29 +02:00
Jan Ekström 27c0dd5560 avfilter/vf_zscale: fix mapping of zimg_chroma_location_e to AVChromaLocation
The AVChromaLocation values are one higher than zimg's, not one
lower as the undefined value is set to zero (as opposed to zimg's
-1).
2021-10-28 23:13:51 +03:00
Jan Ekström cd1d09e81b avfilter/vf_zscale: deduplicate output color information setting
This way a piece of logic is not missed in one location or the other,
such as the case with chroma location outside the if.
2021-10-28 23:13:51 +03:00
Paul B Mahol 8c2f142bd9 avfilter/vf_psnr/ssim: fix typos 2021-10-28 21:12:09 +02:00
Paul B Mahol 148c030395 avfilter/vf_histogram: add more color modes 2021-10-27 11:29:29 +02:00
Paul B Mahol 97b5b9dbea avfilter: split negate filter from lut filter
Using luts for negating is suboptimal.

FATE test changes because filter no longer clips values into limited color range.
2021-10-27 11:29:29 +02:00
Michael Niedermayer 069f7831a2 avfilter/vf_owdenoise: relicense my code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-24 16:54:36 +02:00
Paul B Mahol 9df3f147f5 avfilter/vf_v360: do not reset yaw/pitch/roll with reset_rot true 2021-10-24 14:08:10 +02:00
Paul B Mahol 9353d1a60f avfilter/vf_v360: replace deprecated FF_CEIL_RSHIFT() 2021-10-24 14:08:10 +02:00
Paul B Mahol 97cff84f10 avfilter/vf_dblur: add clipping 2021-10-23 23:53:51 +02:00
Paul B Mahol 2148934ce3 avfilter/vf_dblur: use lrintf() 2021-10-23 23:38:39 +02:00
Paul B Mahol a586ce0a21 avfilter/vf_dblur: fix artifacts 2021-10-23 23:38:39 +02:00
Paul B Mahol 6c45d34e50 avfilter/vf_convolution: improve runtime support for convolution filter 2021-10-23 14:51:42 +02:00
Paul B Mahol 9e8bb9efd9 avfilter/vf_convolution: unbreak runtime planes option functionality
For non-convolution filters like sobel.
2021-10-23 14:51:42 +02:00
Paul B Mahol eda2a50c8e avfilter/vf_selectivecolor: no need to use doubles 2021-10-22 13:57:42 +02:00
Paul B Mahol 7d463be590 avfilter/vf_bilateral: add slice threading support 2021-10-22 12:20:40 +02:00
Paul B Mahol 444cf3fca8 avfilter/vf_bilateral: add direct aka writable frame support 2021-10-22 09:36:54 +02:00
Paul B Mahol cf0881bcfc avfilter/vf_bilateral: properly round float result 2021-10-21 22:02:58 +02:00
Paul B Mahol 4e4057e437 avfilter/vf_bilateral: remove unused arguments 2021-10-21 22:02:58 +02:00
Paul B Mahol f0ad40b525 avfilter/vf_bilateral: remove unneeded multiplications 2021-10-21 22:02:58 +02:00
the.real.laplace@gmail.com c13a2f701d avfilter/vf_eq: add support for alpha channel
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-10-21 14:13:03 +02:00
Limin Wang b22b8e5489 avfilter/vf_showinfo: small adjustments for the HDR10+ dump
summary for the adjustments:
1, remove the extra "," in the ,}
...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,}
to
...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013}

2, add "," between the } and new field
} fraction_bright_pixels
to
}, fraction_bright_pixels

3, remove the extra space between "} }"
...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,} }
to
...{0.2004,0.3001,0.4008,0.5005,0.6002,0.7009,0.8006,0.9013,}}

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-20 22:47:42 +08:00
Limin Wang 3253133382 avfilter/af_replaygain: use fabsf() instead of fabs()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-10-20 22:47:36 +08:00
Paul B Mahol 960efa94ff avfilter/vf_v360: make reset_rot option not lose its value
Unless -1 value is provided then rotation is reset single time.
2021-10-20 14:49:13 +02:00
Paul B Mahol 407acc0747 avfilter: add varblur video filter 2021-10-19 08:53:56 +02:00
Paul B Mahol f7ddf4fc57 avfilter/af_alimiter: add timeline and commands support 2021-10-18 22:46:36 +02:00
Paul B Mahol 374d646930 avfilter/vf_fftdnoiz: fix missing funcionality 2021-10-18 21:34:08 +02:00
Paul B Mahol 025ae145de avfilter/vf_fftdnoiz: add command options support 2021-10-18 21:34:08 +02:00
Paul B Mahol 374f2ac370 avfilter/vf_fftdnoiz: add slice threading support 2021-10-18 18:05:31 +02:00
Paul B Mahol bbbf95848b avfilter/vf_w3fdif: do not output extra frame at start with deint=interlaced 2021-10-18 09:29:41 +02:00
Tsutomu Seki 9b445663a5 avfilter/opencl: Fix program_opencl for source code larger than 64kB
The condition (pos < len) is always true and the
rest of the OpenCL program code would not be read, while
the maximum number of "rb" is "len - pos - 1", and then, the
maximum number of the "pos" is "len - 1".

Fixes: trac.ffmpeg.org/ticket/9217
2021-10-16 12:17:23 +02:00
Paul B Mahol 5bcc61ce87 avfilter/vf_v360: add reset_rot option 2021-10-16 11:39:15 +02:00
Paul B Mahol 767f162432 avfilter/window_func: unify all filters win_func option that use this header 2021-10-15 10:45:50 +02:00
James Almer 39f3c98bb1 x86/vf_lut3d: use three operand form for some instructions
Fixes compilation with old yasm.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-10-14 18:09:38 -03:00
Paul B Mahol 890cef1ff6 avfilter/vf_fftfilt: export FFT arrays size 2021-10-14 20:26:23 +02:00