1
0
Fork 0
Commit Graph

11427 Commits

Author SHA1 Message Date
Niklas Haas 25cd0e0913 avfilter/vf_showinfo: adapt to new AVFilmGrainParams 2024-03-23 18:54:36 +01:00
Wenbin Chen f4e0664fd1 libavfi/dnn: add LibTorch as one of DNN backend
PyTorch is an open source machine learning framework that accelerates
the path from research prototyping to production deployment. Official
website: https://pytorch.org/. We call the C++ library of PyTorch as
LibTorch, the same below.

To build FFmpeg with LibTorch, please take following steps as
reference:
1. download LibTorch C++ library in
 https://pytorch.org/get-started/locally/,
please select C++/Java for language, and other options as your need.
Please download cxx11 ABI version:
 (libtorch-cxx11-abi-shared-with-deps-*.zip).
2. unzip the file to your own dir, with command
unzip libtorch-shared-with-deps-latest.zip -d your_dir
3. export libtorch_root/libtorch/include and
libtorch_root/libtorch/include/torch/csrc/api/include to $PATH
export libtorch_root/libtorch/lib/ to $LD_LIBRARY_PATH
4. config FFmpeg with ../configure --enable-libtorch \
 --extra-cflag=-I/libtorch_root/libtorch/include \
 --extra-cflag=-I/libtorch_root/libtorch/include/torch/csrc/api/include \
 --extra-ldflags=-L/libtorch_root/libtorch/lib/
5. make

To run FFmpeg DNN inference with LibTorch backend:
./ffmpeg -i input.jpg -vf \
dnn_processing=dnn_backend=torch:model=LibTorch_model.pt -y output.jpg

The LibTorch_model.pt can be generated by Python with torch.jit.script()
api. https://pytorch.org/tutorials/advanced/cpp_export.html. This is
pytorch official guide about how to convert and load torchscript model.
Please note, torch.jit.trace() is not recommanded, since it does
not support ambiguous input size.

Signed-off-by: Ting Fu <ting.fu@intel.com>
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-03-19 14:48:58 +08:00
Timo Rothenpieler b47abd5737 avfilter/vsrc_ddagrab: clear all flags of buffer texture
One some system, one some displays, for unknown reasons,
these contain rather bad flags that cause all kinds of weird
behaviour.
2024-03-16 00:44:58 +01:00
Andreas Rheinhardt c00cd007e8 configure: Remove av_restrict
All versions of MSVC that support C11 (namely >= v19.27)
also support the restrict keyword, therefore av_restrict
is no longer necessary since 75697836b1.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-15 12:51:15 +01:00
Rajiv Harlalka 4700925d22 lavfi/atempo: avoid asendcmd assertion failure
Check for zeros equal to the total samples early, because in
that case we would already be leaving the first few frames out.

Fixes trac ticket #10692
2024-03-13 09:45:17 +00:00
Gyan Doshi 3d1860ec8d avfilter: update filter timeline state only on main link
At present, consume_update evaluates timeline state on all links for
a multi-input filter. This can lead to the filter being incorrectly
en/dis-abled when evaluation on a frame on a secondary link leads to
a different result than the frame on the current main link next in
line for processing.
2024-03-11 15:38:13 +05:30
Martin Storsjö cd420c2949 makefile: Clean up missed object files with "make clean"
In some builds, the following object files could be left behind
after make clean:

./libavfilter/metal/utils.o
./libavfilter/metal/vf_yadif_videotoolbox.metallib.o
./libavcodec/x86/h26x/h2656dsp.o
./libavcodec/neon/mpegvideo.o
./ffbuild/bin2c_host.o

Fixes: http://trac.ffmpeg.org/ticket/10895

Signed-off-by: Martin Storsjö <martin@martin.st>
2024-03-10 23:45:51 +02:00
联盟少侠 e6d933404f avfilter/avfilter: Fix for Incorrect Parameter in ff_filter_config_links
src/libavfilter/internal.h:255:45: note: passing argument to parameter 'filter' here
int ff_filter_config_links(AVFilterContext *filter);

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-08 13:12:21 +01:00
Anton Khirnov abd7da0af9 lavfi: deprecate avfilter_config_links()
It never makes sense for this function to be called by users.
2024-03-08 09:29:54 +01:00
Anton Khirnov 6b1f41e152 lavfi: deprecate avfilter_link_free()
It never makes sense for this function to be called by users.
2024-03-08 09:29:54 +01:00
Haihao Xiang eb7d019b32 lavfi/vulkan_filter: fix input format
Otherwise s->input_format is always yuv420p.

This fixes invalid output format for hwframe download in the command
below:
./ffmpeg -init_hw_device vulkan -f lavfi \
	-i testsrc=duration=1,format=nv12 \
	-vf 'hwupload,format=vulkan,scale_vulkan=1024:768,hwdownload,format=nv12' \
	-f null -

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-03-08 10:10:51 +08:00
Niklas Haas c2a233fe14 avfilter/vf_showinfo: add AVFilmGrainAOMParams support
For testing purposes.
2024-03-07 21:08:53 +01:00
James Almer 783d00b203 libs: bump major version for all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 11:29:43 -03:00
Andreas Rheinhardt 71c7e9c5f4 avfilter/avfilter: Reorder structure fields
Move related fields closer together and try to plug holes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt a76592440e avfilter/avfilter: Remove always-NULL pointers to internal contexts
Made possible by db98b0e04e
and 03567ed80c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
James Almer b8fef7e9c5 avutil: remove deprecated FF_API_PKT_DURATION
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer 65ddc74988 avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
James Almer e58afae1e4 avfilter: remove deprecated FF_API_LIBPLACEBO_OPTS
Signed-off-by: James Almer <jamrial@gmail.com>
2024-03-07 08:53:30 -03:00
Andrew Sayers 6096c244bb fix /// comments that should be ///<
Actual command: sed -i -e "s/\([;,] *\)<* *\/\/\/ *<* */\1\/\/\/< /" $( git grep -l "[;,] */// " )

Signed-off-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
2024-03-04 17:38:57 +01:00
Andreas Rheinhardt e429b0fdb7 avutil/vulkan: Don't autoinclude vulkan_loader.h
Only include it where necessary.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-03 22:55:26 +01:00
Zhao Zhili ab8aab5e2f avfilter/vf_scale_vulkan: Fix typo
Fix #10875

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-03-01 17:22:25 +08:00
Fei Wang b5714d1f91 avfilter/tonemap_vaapi: Remove duplicate format check
Supported formats are checked in base function ff_vaapi_vpp_config_output.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-02-26 14:52:06 +08:00
Andreas Rheinhardt b4b8b9ad5c avfilter/avfilter: Suppress warning for variable only used in av_assert1
Forgotten in e7f9edb469.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-25 13:42:44 +01:00
Stone Chen ef917950f0 avfilter/vf_convolution: add float user_rdiv[4] to allow user options to apply correctly
Previously to support dynamic reconfigurations of the matrix string (e.g. 0m),
the rdiv values would always be cleared to 0.f, causing the rdiv to be
recalculated based on the new filter. This however had the side effect of
always ignoring user specified rdiv values.

Instead float user_rdiv[0] is added to ConvolutionContext which will store the
user specified rdiv values. Then the original rdiv array will store either the
user_rdiv or the automatically calculated 1/sum.

This fixes trac ticket #10294, #10867.

Signed-off-by: Stone Chen <chen.stonechen@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-25 10:49:37 +01:00
Andreas Rheinhardt e2afcb8242 avfilter/af_pan: Uninitialize channel layout
Fixes a leak in the mov-mp4-pcm-float FATE test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-20 18:41:45 +01:00
Andreas Rheinhardt 32538dafca avfilter/avfilter: Move frame_pool to FilterLinkInternal
Avoids ugly casts when uninitializing.
(One could actually avoid allocating this separately if one
were willing to expose FFFramePool to those files including
link_internal.h.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 4a7329994a avfilter/avfilter: Move age_index to FilterLinkInternal
Also make FFFilterGraph.sink_links a FilterLinkInternal**
because sink_links is used to access FilterLinkInternal
fields.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 40b91eaea9 avfilter/avfilter: Move init_state to FilterLinkInternal
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 89eea4e19a avfilter/avfilter: Move AVFilterGraph private fields to FFFilterGraph
(These fields were in AVFilterGraph although AVFilterGraphInternal
existed for years.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 03567ed80c avfilter/avfiltergraph: Avoid allocation for AVFilterGraphInternal
To do this, allocate AVFilterGraphInternal jointly with AVFilterGraph
and rename it to FFFilterGraph in the process (similarly to
AVStream/FFStream).
The AVFilterGraphInternal* will be removed on the next major version
bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt a1aec776f1 avfilter/avfiltergraph: Avoid indirection when freeing filtergraph
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt a272c9cffa avfilter: Add a header for internal generic-layer APIs
This commit moves the generic-layer stuff (that is not used
by filters) to a new header of its own, similarly to
5e7b5b0090 for libavcodec.
thread.h and link_internal.h are merged into this header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt db98b0e04e avfilter/avfilter: Avoid allocation for AVFilterInternal
To do this, allocate AVFilterInternal jointly with AVFilterContext
and rename it to FFFilterContext in the process (similarly to
AVStream/FFStream).
The AVFilterInternal* will be removed from AVFilterContext
on the next major bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt cc36a9f5b9 avfilter/signature_lookup: Avoid branch when adding to linked list
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt 626a076249 avfilter/signature_lookup: Remove useless error logs
These logs use the wrong loglevel and are uninformative;
and it is of course highly unlikely that a buffer of 56B
can't be allocated.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt bf82b6517e avfilter/signature_lookup: Allocate buffers jointly
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt eeb99dcb51 avfilter/signature_lookup: Check for allocation error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Andreas Rheinhardt c149d86760 avfilter/vf_signature: Allocate arrays together
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-18 16:38:09 +01:00
Michael Niedermayer 7f36127595
avfilter/v360: Use AV_VIDEO_MAX_PLANES
Issue found through Coverity CID1457948

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-16 21:34:38 +01:00
Andreas Rheinhardt e7f9edb469 avfilter/avfilter: Fix build with ASSERT_LEVEL >= 1
Broken in 86417b759f.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 15:35:47 +01:00
Anton Khirnov 86417b759f lavfi: get rid of FF_INTERNAL_FIELDS
This hack is used to limit the visibility of some AVFilterLink fields to
only certain files. Replace it with the same pattern that is used e.g.
in lavf AVStream/FFStream and avoid exposing these internal fields in a
public header completely.
2024-02-14 15:08:49 +01:00
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
Andreas Rheinhardt 8a2c8687bd avfilter/af_hdcd: Drop a redundant log
avfilter_insert_filter() already reports (also with AV_LOG_VERBOSE)
when a filter is auto-inserted.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:24:55 +01:00
Andreas Rheinhardt b84d286ac7 avfilter/vf_(bwdif|yadif)_cuda: Remove unused variables
Forgotten in 268062fa15.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-14 13:18:42 +01:00
Niklas Haas d2ae2aad8c avfilter/buffersrc: allow promoting color range to MPEG
Otherwise, passing an UNSPECIFIED frame to am MPEG-only filter graph
would trigger insertion of an unnecessary vf_scale filter, which would
perform a memcpy to convert between the two.

This is safe to do because unspecified YUV frames are already
universally assumed to be MPEG range, in particular by swscale.
2024-02-13 19:30:14 +01:00
Niklas Haas 2303bf3232 avfilter/buffersrc: promote unspecified color metadata
Currently, this only affects untagged RGB/XYZ/Gray, which get forced to
their corresponding metadata before entering the filter graph. The main
justification for this change, however, is the planned ability to add
automatic promotion of unspecified yuv to mpeg range yuv.

Notably, this change will never allow accidentally cross-promoting
unspecified to jpeg or to a specific YUV matrix, since that is still
bound by the constraints of YUV range negotiation as set up by
query_formats.
2024-02-13 19:30:14 +01:00
Niklas Haas 3bf80df3cc avfilter/vf_setparams: use YUV colorspace negotiation API
When this filter overrides frame properties, the outgoing frames have
a different YUV colorspace than the incoming ones. This requires
signalling the new colorspace on the outlink, and in particular, making
sure it's *not* set to a common ref with the input - otherwise the point
of this filter would be destroyed.

Untouched fields will continue being passed through, so we don't need to
do anything there.
2024-02-13 15:56:03 +01:00
Michael Niedermayer 98ae1ad7cf
avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure
Fixes: CID 1403229 Dereference after null check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:46 +01:00
Michael Niedermayer 6c50482951
avfilter/signature_lookup: dont leave uncleared pointers in sll_free()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-02-12 00:50:45 +01:00
Niklas Haas 75f4cb81de avfilter/buffersink: add color_spaces, color_ranges params
An oversight in my previous series. This omission slipped under the
radar because fftools/ffmpeg_filter.c did not use these options, instead
preferring to insert an explicit format filter.
2024-02-09 21:02:08 +01:00