Commit Graph

11525 Commits

Author SHA1 Message Date
Andreas Rheinhardt
dfd0320e23 avfilter/vf_signalstats: Use 64bit for processing histogram
The result might not fit into 32bit if an image has gigantic
dimensions and one of the planes has a dominant value
(particularly so if said value is big).

Fixes Coverity issues #1598399, #1598401, #1598402, #1598403, #1598404.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
Zhao Zhili
6de951923b avfilter/dnn: Remove a level of dereference
For code such as 'model->model = ov_model' is confusing. We can
just drop the member variable and use cast to get the subclass.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:31 +08:00
Zhao Zhili
a1fea7e11b avfilter/dnn_backend_torch: Simplify memory allocation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:27 +08:00
Zhao Zhili
abfefbb33b avfilter/dnn_backend_tf: Simplify memory allocation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:21 +08:00
Zhao Zhili
a40df366c4 avfilter/dnn_backend_tf: Fix free context at random place
It will be freed again by ff_dnn_uninit.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:17 +08:00
Zhao Zhili
d3db7bbc03 avfilter/dnn_backend_tf: Remove one level of indentation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:10 +08:00
Zhao Zhili
57a3c2cd40 avfilter/dnn_backend_openvino: simplify memory allocation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:07 +08:00
Zhao Zhili
ac52cee72e avfilter/dnn_backend_openvino: Fix free context at random place
It will be freed again by ff_dnn_uninit.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:14:00 +08:00
Zhao Zhili
093f5da534 avfilter/dnn: Don't show backends which are not supported by a filter 2024-05-30 18:13:46 +08:00
Zhao Zhili
4f051c746b avfilter/dnn: Use dnn_backend_info_list to search for dnn module
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-30 18:13:29 +08:00
Andreas Rheinhardt
ece95dc3dc avfilter/af_atempo: Fix indentation
Forgotten after b8f74ee57a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-23 10:45:55 +02:00
Andreas Rheinhardt
42e0e05834 avfilter/af_atempo: Simplify resetting
The earlier code distinguished between a partial reset
(yae_clear()) and a complete reset (yae_release_buffers()
which also releases the buffers); this separation existed
to avoid allocations, as buffers were reallocated on reconfigs.

Yet it is pointless since a5704659e3,
so simply use yae_release_buffers() everywhere.

Reviewed-by: Pavel Koshevoy <pkoshevoy@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-23 10:45:25 +02:00
Andreas Rheinhardt
35e7fa0a2e avfilter/af_atempo: Properly check av_tx_init()
Fixes Coverity issue #1516804.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-23 10:45:16 +02:00
Zhao Zhili
553c572204 avfilter/vf_dnn_detect: Fix null pointer dereference
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-21 18:17:07 +08:00
Andreas Rheinhardt
9a74581234 avfilter/vf_signalstats: Reindent after the previous commit
Also use loop scope for iterators while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-21 08:56:52 +02:00
Andreas Rheinhardt
48c0cce83d avfilter/vf_signalstats: Deduplicate <= 8 and > 8 bit code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-21 08:56:52 +02:00
Andreas Rheinhardt
f2dac83628 avfilter/vf_signalstats: Use av_dict_set_int() where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-21 08:56:52 +02:00
LuMingYin
3f691c0c6a libavfilter/vf_curves: fix a memory leak on error path
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-05-20 23:57:45 +08:00
Andreas Rheinhardt
0d7430d3ab avfilter/vf_v360: Add assert to suppress Coverity false positives
Should fix many Coverity false positives, namely #1457947-#1457994
as well as #1461195-#146210.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 14:16:39 +02:00
Andreas Rheinhardt
f3d206d25f fftools, avfilter, avformat: Simplify check for "is dictionary empty?"
Reviewed-by: epirat07@gmail.com
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-20 13:52:41 +02:00
Haihao Xiang
127ded5078 lavfi/qsvvpp: require a dynamic frame pool for output if possible
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Haihao Xiang
5646285f76 lavfi/qsvvpp: use the right mfxFrameInfo when dynamic frame pool is used
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-05-20 09:30:49 +08:00
Andrea Mastroberti
90ce54804a
avfilter/smartblur: Added alpha layer support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-19 22:12:53 +02:00
Zhao Zhili
8c21f1e3b7 avfilter/dnn: Refactor DNN parameter configuration system
This patch trying to resolve mulitiple issues related to parameter
configuration:

Firstly, each DNN filters duplicate DNN_COMMON_OPTIONS, which should
be the common options of backend.

Secondly, backend options are hidden behind the scene. It's a
AV_OPT_TYPE_STRING backend_configs for user, and parsed by each
backend. We don't know each backend support what kind of options
from the help message.

Third, DNN backends duplicate DNN_BACKEND_COMMON_OPTIONS.

Last but not the least, pass backend options via AV_OPT_TYPE_STRING
makes it hard to pass AV_OPT_TYPE_BINARY to backend, if not impossible.

This patch puts backend common options and each backend options inside
DnnContext to reduce code duplication, make options user friendly, and
easy to extend for future usecase.

For example,

./ffmpeg -h filter=dnn_processing

dnn_processing AVOptions:
   dnn_backend       <int>        ..FV....... DNN backend (from INT_MIN to INT_MAX) (default tensorflow)
     tensorflow      1            ..FV....... tensorflow backend flag
     openvino        2            ..FV....... openvino backend flag
     torch           3            ..FV....... torch backend flag

dnn_base AVOptions:
   model             <string>     ..F........ path to model file
   input             <string>     ..F........ input name of the model
   output            <string>     ..F........ output name of the model
   backend_configs   <string>     ..F.......P backend configs (deprecated)
   options           <string>     ..F.......P backend configs (deprecated)
   nireq             <int>        ..F........ number of request (from 0 to INT_MAX) (default 0)
   async             <boolean>    ..F........ use DNN async inference (default true)
   device            <string>     ..F........ device to run model

dnn_tensorflow AVOptions:
   sess_config       <string>     ..F........ config for SessionOptions

dnn_openvino AVOptions:
   batch_size        <int>        ..F........ batch size per request (from 1 to 1000) (default 1)
   input_resizable   <boolean>    ..F........ can input be resizable or not (default false)
   layout            <int>        ..F........ input layout of model (from 0 to 2) (default none)
     none            0            ..F........ none
     nchw            1            ..F........ nchw
     nhwc            2            ..F........ nhwc
   scale             <float>      ..F........ Add scale preprocess operation. Divide each element of input by specified value. (from INT_MIN to INT_MAX) (default 0)
   mean              <float>      ..F........ Add mean preprocess operation. Subtract specified value from each element of input. (from INT_MIN to INT_MAX) (default 0)

dnn_th AVOptions:
   optimize          <int>        ..F........ turn on graph executor optimization (from 0 to 1) (default 0)

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Reviewed-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-05-18 19:44:50 +08:00
Marton Balint
b0093ab8a3 avfilter/vf_geq: fix interpolation with 1 pixel width/height
Fixes ticket #9740.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-14 21:07:37 +02:00
Marton Balint
64330e365b avfilter/blend: use a per-thread AVExpr
Otherwise expression state is accessed and changed from multiple threads.

Fixes ticket #10987.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-14 21:07:37 +02:00
Marton Balint
a69a0b689c avfilter/blend: put slice parameters to a single struct
This should make future extensibility easier.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-14 21:07:37 +02:00
Marton Balint
77fc047bd9 avfilter/vsrc_testsrc: do not round down width and height for color src
ff_draw_rectangle handles subsampling since 2013.

Fixes ticket #10989.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-14 21:07:37 +02:00
J. Dekker
ca583b22e4 avfilter/riscv: build afir only if required
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-05-14 17:46:19 +02:00
Andreas Rheinhardt
ebe78e3ef0 avfilter/af_volume: Don't free options manually
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-09 13:18:32 +02:00
PoorvaGaikar
8b6e66d0f0 avfilter/f_select.c: add support for iw and ih variables
Fixes ticket #10509.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-05-08 21:33:32 +02:00
Andreas Rheinhardt
894879a1df avfilter/Makefile: Add missing morpho->framesync dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
b5cf359c97 avfilter/Makefile: Add missing identity->framesync dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
9ec928e627 avfilter/x86/Makefile: Fix standalone build of haldclut filter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
0d80348748 avfilter/vf_lut3d: Fix standalone build of lut1d
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
afda5ee7b9 avfilter/Makefile: Add missing multiply->framesync dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
c11d7ca2f0 avfilter/x86/Makefile: Add missing dependencies for sobel filter
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
3c7dc9ea59 avfilter/vf_convolution: Fix compilation with sobel disabled
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
dd246bdc0f avfilter/Makefile: Add missing guided->framesync dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
7e582d8b3e avfilter/vsrc_testsrc: Fix compilation of colorchart filter
Move set_color() out of the CONFIG_TESTSRC2_FILTER block.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
03618ee8a8 avfilter/Makefile: Add scale(2ref)->framesync dependency
Forgotten in e82a3997cd.

Reviewed-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
2e1b95283e avfilter/vf_xmedian: Define OFFSET, FLAGS macros unconditionally
They are currently defined inside the #if CONFIG_XMEDIAN_FILTER
block. Fixes standalone compilation of the tmedian filter.
Broken in f58939affe.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
db53ee915d avfilter/Makefile: Add missing colormap->framesync dependency
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
Andreas Rheinhardt
609d2c01ea avfilter/Makefile: Add missing tiltshelf entry
Forgotten in 525f83becd.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-07 23:53:26 +02:00
James Almer
82397084a9 avfilter/vf_scale: properly reinitialize framesync
Fixes leaks as reported by ASAN and Valgrind.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
ccf395e8bd avfilter/framesync: reset nb_in on allocation failure
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
James Almer
eb392e4100 avfilter/vf_scale: don't expose framesync options in vf_scale2ref
It doesn't use them.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-05 21:37:07 -03:00
Niklas Haas
6a5b021e35 avfilter/vf_scale: fix input declaration
This filter needs to be marked as having only one input by default, with
AVFILTER_FLAG_DYNAMIC_INPUTS allowing the extra input to be added at
init() time.

Fixes: bb80445813
2024-05-04 13:07:27 +02:00
Niklas Haas
95568c4e31 avfilter/scale2ref: deprecate in favor of scale=rw:rh
And remove it from the documentation.
2024-05-03 14:23:23 +02:00
Niklas Haas
bb80445813 avfilter/vf_scale: add optional "ref" input
This is automatically enabled if the width/height expressions reference
any ref_* variable. This will ultimately serve as a more principled
replacement for the fundamentally broken scale2ref.

See-Also: https://trac.ffmpeg.org/ticket/10795
2024-05-03 14:23:23 +02:00