Commit Graph

9964 Commits

Author SHA1 Message Date
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