1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

11783 Commits

Author SHA1 Message Date
Lynne
12f868cab5
vulkan_shaderc: add debug information to shaders 2024-08-11 05:13:13 +02:00
Lynne
2f7dfb0d15
vulkan_shaderc: fix error reporting for certain errors
The issue is that shaderc_result_get_num_errors may sometime
return 0 even when shaderc_result_get_compilation_status returns
a non-zero error code.
Since we use the result from the former, override the status
if it returned 0.
2024-08-11 05:13:12 +02:00
Rémi Denis-Courmont
f30e5bf1f5 lavfi/riscv: depend on RVB and simplify accordingly 2024-08-05 21:16:26 +03:00
Anton Khirnov
43f702a253 lavfi/framesync: avoid forcing frame writability unnecessarily
Callers of ff_framesync_get_frame() generally do not expect the result
to be writable, those that do (e.g. ff_framesync_dualinput_get_writable())
ensure writability themselves.

Significantly reduces memory consumption in complex graphs with
framesync-based filters (e.g. scale, ssim).

Reported-By: Mark Shwartzman
2024-07-31 11:12:45 +02:00
Rémi Denis-Courmont
b5c111272b lavfi/riscv: add forward-edge CFI landing pads 2024-07-25 23:10:14 +03:00
Rémi Denis-Courmont
9108f3e5e1 lavfi/riscv: require B or zba explicitly 2024-07-25 18:55:48 +03:00
Michael Niedermayer
73ca4e75eb
avfilter/vf_xfade: Check ff_inlink_consume_frame() for failure
Fixes: CID1458043 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 17:02:14 +02:00
Michael Niedermayer
2a8fb3c2cc
avfilter/vf_scale: Check ff_scale_adjust_dimensions() for failure
Helps: CID1513722 Operands don't affect result

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:31 +02:00
Michael Niedermayer
ad9df8bcfe
avfilter/scale_eval: Use 64bit, check values in ff_scale_adjust_dimensions()
Found by reviewing CID1513722 Operands don't affect result

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:30 +02:00
Michael Niedermayer
6db4e326c2
avfilter/vf_neighbor_opencl: Use AV_PIX_MAX_PLANES
Fix/Robustness/whatever: CID1439575 Out-of-bounds read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:29 +02:00
Michael Niedermayer
ace2e25720
avfilter/vf_lut3d: Check av_scanf()
Fixes: CID1604398 Unchecked return value
Fixes: CID1604542 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:28 +02:00
Michael Niedermayer
64aa233a88
avfilter/vf_fftfilt: Remove dead depth code
Fixes: CID1509373 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:27 +02:00
Michael Niedermayer
2af95b9214
avfilter/vf_elbg: Use unsigned for shifting into the top bit
Fixes: part of CID1355110 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 16:34:25 +02:00
Michael Niedermayer
05e21b8902
avfilter/vf_premultiply: Use AV_PIX_MAX_PLANES
Helps: CID1435164 Out-of-bounds read
Helps: CID1435165 Out-of-bounds read
Helps: CID1435167 Out-of-bounds read
Helps: CID1435169 Out-of-bounds read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 15:57:43 +02:00
Michael Niedermayer
9385847af4
avfilter/vf_deshake_opencl: Ensure that the first iteration initializes the best variables
Fixes: CID1452759 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 15:52:09 +02:00
Michael Niedermayer
c37dc63c7d
avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES
Fixes: CID1452758 Out-of-bounds read (actual out of bounds access depends on a frame with more than 3 planes)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-21 15:52:08 +02:00
Michael Niedermayer
a7f5845a6c
avfilter: Free out on error
CID1197065 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:41 +02:00
Michael Niedermayer
19a5a8997c
avfilter/vf_convolution_opencl: Assert that the filter name is one of the filters
Helps with: CID1439572 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:40 +02:00
Michael Niedermayer
ec18ec9fc1
avfilter/vf_bm3d: Dont round MSE2SSE to an integer
Fixes: CID1439581 Result is not floating-point

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:39 +02:00
Michael Niedermayer
ffba528bc6
avfilter/vf_avgblur_opencl: Use AV_VIDEO_MAX_PLANES
Fixes: CID1437470 Out-of-bounds read (out of bounds read would only occur with a pixel format of more than 4 planes)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-15 01:59:39 +02:00
Marvin Scholz
613c85a8f5
avfilter/af_channelsplit: fix mixed declaration and code
Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
2024-07-14 15:43:01 -04:00
Michael Niedermayer
20e59af07e
avfilter/vf_tiltandshift: Free dst on error
Fixes: CID1559901 Resource leak

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-12 21:58:50 +02:00
James Almer
0b6c5e9df4 avfilter/vf_crop: prevent integer overflows when calculating SAR
Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-11 10:22:47 -03:00
Marvin Scholz
6d9c4bd69e
lavfi/perlin: Fix out of bounds stack buffer write
An incorrect calculation in ff_perlin_init causes a write to the
stack array at index 256, which is out of bounds.

Fixes: CID1608711
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-10 18:10:08 +02:00
Niklas Haas
0deb301ba9 avfilter/vf_scale: test return code of scale_frame()
Instead of testing the returned frame against NULL, test the return code
itself, going more in line with the usual behavior of such functions.
2024-07-10 11:38:44 +02:00
Niklas Haas
084e0b364d avfilter/vf_scale: fix frame lifetimes
scale_frame() inconsistently handled the lifetime of `in`. Fixes a
possible double free and a possible memory leak.

The new code always has `scale_frame` take over ownership of the input
frame. I first tried writing this code in a way where the calling code
retains ownership, but this is nontrivial due to the presence of the
no-op short-circuit condition in which the input frame is directly
returned. (As an alternative, we could use av_frame_clone() instead, but
I wanted to avoid touching the original behavior in this commit)
2024-07-10 11:38:44 +02:00
Michael Niedermayer
382e9e79f3
avfilter/af_aderivative: Free out on error
Fixes: CID1197065 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:30 +02:00
Michael Niedermayer
62d4414d54
avfilter/af_amerge: Cleanup on av_channel_layout_copy() failure
Fixes: CID1503088 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:29 +02:00
Michael Niedermayer
a5c815f937
avfilter/af_afir: Assert format
Maybe helps: CID1516805 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:29 +02:00
Michael Niedermayer
8f9a6c4ea8
avfilter/af_afftdn: Assert format
Maybe helps: CID1515514 Uninitialized scalar variable
Maybe helps: CID1515517 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:29 +02:00
Michael Niedermayer
5fe8bf4aa5
avfilter/af_pan: check nb_output_channels before use
Fixes: CID1500281 Out-of-bounds write
Fixes: CID1500331 Out-of-bounds write

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:28 +02:00
Michael Niedermayer
2d0d502ff1
avfilter/af_mcompand: compute half frequency in double
Fixes: CID1422217 Result is not floating-point

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:28 +02:00
Michael Niedermayer
cef720ab42
avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds
Maybe Helps: CID1503077 Bad bit shift operation

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:28 +02:00
Michael Niedermayer
7a0ea15c7a
avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure
Fixes: CID1503078 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-07 23:36:27 +02:00
James Almer
a528a54ee1 avfilter/vf_tiltandshift: fix buffer offset for yuv422p input
Fixes ticket #10950.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-07-06 10:50:55 -03:00
Jun Zhao
03c2e9d77e lavf/scdet: minor fix
Change dbl to i64 for bool type

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2024-07-05 18:06:14 +08:00
Michael Niedermayer
c296d4fdec
avfilter/vf_avgblur: Check plane instead of AVFrame
Fixes: CID1551694 Use after free (false positive based on assuming that out == in and one is freed and one used)

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:25 +02:00
Michael Niedermayer
34f821e448
avfilter/drawutils: Fix depthb computation
Fixes: CID1496940 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Michael Niedermayer
aab0c344c5
avfilter/avf_showcwt: Check av_parse_video_rate() for failure
Fixes: CID1539147 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-07-02 21:57:24 +02:00
Andrew Sayers
5d54a25eea avfilter/af_afade: fix opt_type for nb_samples/ns
The actual value is an int64_t, and is accessed elsewhere as AV_OPT_TYPE_INT64.
2024-07-01 23:16:44 +02:00
Stefano Sabatini
3764b8ecdb lavfi: add Perlin noise generator 2024-07-01 22:31:02 +02:00
Andreas Rheinhardt
2330e77c97 avfilter/textutils: Constify ff_expand_text()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-30 11:37:06 +02:00
Andreas Rheinhardt
ba457e9adb avfilter/textutils,vf_drawtext,qrencode: Constify function pointers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-30 11:37:04 +02:00
James Almer
0cb733d276 avfilter/vf_showinfo: don't use sizeof(AVSphericalMapping)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 13:16:57 -03:00
James Almer
beacdbf4b4 avfilter/vf_showinfo: only print yaw, pitch, and roll if set
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 13:16:51 -03:00
James Almer
778096757d avfilter/vf_showinfo: use av_spherical_projection_name()
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 12:57:49 -03:00
James Almer
6da38e11f6 avfilter/vf_showinfo: don't use sizeof(AVStereo3D)
It's not part of the libavutil ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 12:57:49 -03:00
James Almer
3478cf2c2d avfilter/vf_showinfo: print more Stereo 3D fields
Signed-off-by: James Almer <jamrial@gmail.com>
2024-06-28 12:57:49 -03:00
Michael Niedermayer
0da6865ce2
avfilter/qsvvpp: Remove unreachable code
Fixes: CID1598548 Logically dead code

Sponsored-by: Sovereign Tech Fund
Reviewed-by: "Xiang, Haihao" <haihao.xiang@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-19 13:23:07 +02:00
Michael Niedermayer
9c9f095e30
avfilter/vf_rotate: Check ff_draw_init2() return value
Fixes: NULL pointer dereference
Fixes: 3_343

Found-by: De3mond
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:14 +02:00
Rémi Denis-Courmont
378d1b06c3 riscv: probe for Zbb extension at load time
Due to hysterical raisins, most RISC-V Linux distributions target a
RV64GC baseline excluding the Bit-manipulation ISA extensions, most
notably:
- Zba: address generation extension and
- Zbb: basic bit manipulation extension.
Most CPUs that would make sense to run FFmpeg on support Zba and Zbb
(including the current FATE runner), so it makes sense to optimise for
them. In fact a large chunk of existing assembler optimisations relies
on Zba and/or Zbb.

Since we cannot patch shared library code, the next best thing is to
carry a flag initialised at load-time and check it on need basis.
This results in 3 instructions overhead on isolated use, e.g.:
1:  AUIPC rd, %pcrel_hi(ff_rv_zbb_supported)
    LBU   rd, %pcrel_lo(1b)(rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

The C compiler will typically load the flag ahead of time to reducing
latency, and can also keep it around if Zbb is used multiple times in a
single optimisation scope. For this to work, the flag symbol must be
hidden; otherwise the optimisation degrades with a GOT look-up to
support interposition:
1:  AUIPC rd, GOT_OFFSET_HI
    LD    rd, GOT_OFFSET_LO(rd)
    LBU   rd, (rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

This patch adds code to provision the flag in libraries using bit
manipulation functions from libavutil: byte-swap, bit-weight and
counting leading or trailing zeroes.
2024-06-11 20:12:37 +03:00
Wenbin Chen
7560db937d libavfi/dnn: enable LibTorch xpu device option support
Add xpu device support to libtorch backend.
To enable xpu support you need to add
 "-Wl,--no-as-needed -lintel-ext-pt-gpu -Wl,--as-needed" to
"--extra-libs" when configure ffmpeg.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2024-06-08 19:45:21 +08:00
Gerion Entrup
300df41c30
libavfilter/signature_lookup: fix jaccard distance
Actually, the jaccard distance is defined as D = 1 - intersect / union.
Additionally, the distance value is compared against a constant that
must be between 0 and 1, which is not the case here. Both facts together
has led to the fact, that the function always returned a matching course
signature. To leave the constant intact and to avoid floating point
computation, this commit multiplies with 1 << 16 making the constant
effectively 9000 / (1<<16) =~ 0.14.

Reported-by: Sachin Tilloo <sachin.tilloo@gmail.com>
Reviewed-by: Sachin Tilloo <sachin.tilloo@gmail.com>
Tested-by: Sachin Tilloo <sachin.tilloo@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-07 21:42:23 +02:00
Gyan Doshi
d55f5cba7b avfilter/trim: flag trim filter as metadata only
Similar to select filter for video - it can only pass through or drop frames
2024-06-06 15:09:45 +05:30
Rémi Denis-Courmont
b114952030 lavfi: get rid of bespoke double scalar products 2024-05-31 22:22:43 +03:00
Andreas Rheinhardt
2d818644a3 avfilter/af_afir: Merge header into af_afir.c
Done in 0df18f29ae,
accidentally undone in 163e737c17.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
Andreas Rheinhardt
21bfc62642 avfilter/af_aiir: Avoid unchecked allocation
W has not been checked at all; allocate it jointly with M
to fix this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
Andreas Rheinhardt
37cc648fbd avfilter/af_aiir: Remove dead code
Fixes Coverity issue #1468252.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
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
Niklas Haas
e82a3997cd avfilter/vf_scale: switch to FFFrameSync
Preliminary commit, in anticipation of adding support for multiple
inputs (with proper synchronization and activate() callback).
2024-05-03 14:23:23 +02:00
Niklas Haas
a5032dc12a avfilter/framesync: make framesync_class un-static
And rename to ff_framesync_class. More convenient for downstream users.
2024-05-03 14:23:22 +02:00
Michael Niedermayer
e757726e89
avfilter/avfiltergraph: return value of ff_request_frame() is unused
Fixes: CID1397741 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-01 02:57:13 +02:00
Haihao Xiang
578ac59887 lavfi/qsv: Copy metadata fields from the given input
Currently it always copies the metadata fields from the last input when
there are multiple inputs for the filter. For example, the metadata
fields from input1 are copied to the output for overlay_qsv filter,
however for regular overlay filters, the metadata fields from input0 are
copied to the output. With this fix, we may copy the metadata fields
from input0 to the ouput as well.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-29 11:08:41 +08:00
Niklas Haas
a2cdb2f5be avfilter/f_sidedata: synchronize with side data list
Add all recently added frame data types, as well as the more consistent
name DETECTION_BBOXES as an alias to DETECTION_BOUNDING_BOXES.
2024-04-26 21:02:46 +02:00
Michael Niedermayer
02301017d2
avfilter/vf_thumbnail_cuda: Set ret before checking it
Fixes: CID1418336 Logically dead code

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-04-24 02:52:17 +02:00
Michael Niedermayer
e7174e66ac
avfilter/signature_lookup: Dont copy uninitialized stuff around
Fixes: CID1403238 Uninitialized pointer read
Fixes: CID1403239 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-04-24 02:52:16 +02:00
Michael Niedermayer
25cb66369e
avfilter/signature_lookup: Fix 2 differences to the refernce SW
Fixes: CID1403227 Division or modulo by float zero

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-04-24 02:52:16 +02:00
Xinpeng Sun
35ae44c615 lavfi/tonemap_vaapi: Add support for HDR to HDR tone mapping
Usage example:
ffmpeg -y -hwaccel vaapi -hwaccel_output_format vaapi -i hdr.mp4 \
-vf "tonemap_vaapi=display=7500 3000|34000 16000|13250 34500|15635 16450|500 10000000:extra_hw_frames=64" \
-c:v hevc_vaapi output.mp4

Signed-off-by: Xinpeng Sun <xinpeng.sun@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang
db22804145 lavfi/tonemap_vaapi: Update the log
demote the message to AV_LOG_VERBOSE.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang
3172a6722e lavfi/tonemap_vaapi: By default use bt709 for output frame
By default don't use the color properties from input frame as output
frame properties when performing HDR to SDR conversion

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang
5c55e4e297 lavfi: Add drawbox_vaapi filter
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang
42eb10ecc6 lavfi: Add pad_vaapi filter
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Haihao Xiang
16616a3d1b lavfi/vaapi_vpp: Use dynamic frame pool in outlink if possible
This can avoid to exhaust the buffers within outlink when libva2 is
available.

For example:
$ ffmpeg -hwaccel_output_format vaapi -hwaccel vaapi -i input.mp4 \
-vf 'scale_vaapi=w=720:h=480' -c:v hevc_vaapi -f null -
...
[vf#0:0 @ 0x55acad91f400] Error while filtering: Cannot allocate memory
[vf#0:0 @ 0x55acad91f400] Task finished with error code: -12 (Cannot
allocate memory)
[vf#0:0 @ 0x55acad91f400] Terminating thread with return code -12
(Cannot allocate memory)

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2024-04-18 14:43:07 +08:00
Nicolas Gaullier
376b3d53c5 avfilter/vf_colorspace: use colorspace negotiation API
Fixes a regression due to the fact that the colorspace filter does
not use the new API introduced by 8c7934f73a.
The scale filter uses it since 45e09a3041, and the setparams
filter since 3bf80df3cc.

Example:
ffprobe -f lavfi yuvtestsrc,setparams=color_primaries=bt470bg:color_trc=
bt470bg:colorspace=bt470bg,colorspace=bt709:range=tv,scale,showinfo

Before:
  color_range:unknown color_space:bt470bg ...
After:
  color_range:tv color_space:bt709 ...

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-04-17 22:17:56 +02:00
LuMingYin
5e380bcdb1 avfilter/af_channelsplit: fix memory leak
Signed-off-by: LuMingYin <lumingyindetect@163.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-04-15 10:30:46 +08:00
Fei Wang
0534d2ac84 lavfi/dnn_backend_torch: Include mem.h
Fix build fail since 790f793844.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2024-04-10 18:18:49 +08:00
Marton Balint
4721b9f15f avfilter/buffersrc: never override channel count in av_buffersrc_add_frame_flags
Overriding unknown layouts with the negotiated layout is OK, but the number of
channels should match with what was negotiated.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-04-09 23:12:46 +02:00
Anton Khirnov
d7cde009ce lavfi/avfilter: add an "auto" constant to the threads option
Analogous to the same constant in avfiltergraph and avcodec.
Cf. f599ae88c2.
2024-04-09 10:34:18 +02:00
Anton Khirnov
b0e1bc6298 lavfi/vf_scale: fix AVOption flags for "size"/"s" 2024-04-09 10:34:18 +02:00
Wenbin Chen
478d97f303 libavfilter/dnn_io_proc: Take step into consideration when crop frame
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-04-04 14:26:57 +08:00
Wenbin Chen
8869f5ce86 libavfilter/dnn_backend_openvino: Check bbox's height
Check bbox's height with frame's height rather than frame's width.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-04-04 14:26:52 +08:00
Jan Ekström
23d1b50175 avfilter/{buffersrc,vf_setparams}: map IPT-C2, YCgCo-R variants 2024-04-03 21:31:35 +03:00
Andreas Rheinhardt
7895d1860f avfilter/avfilter: Don't use av_uninit
GCC 9-13 do not emit warnings for this at all optimization
levels even when -Wmaybe-uninitialized is not disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
8d3fdb42c0 avfilter/vf_grayworld: Remove empty options and AVClass
This filter only had an AVClass and empty options because up until
recently, avfilter_init_str() errored out when options were provided
for a filter without an AVClass. But setting (generic) options is
necessary to take advantage of timeline support. So with
avfilter_init_str() fixed, the AVClass and the options can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
de288e406a avfilter/vf_hflip: Remove empty options and AVClass
This filter only had an AVClass and empty options because up until
recently, avfilter_init_str() errored out when options were provided
for a filter without an AVClass. But setting (generic) options is
necessary to take advantage of timeline support. So with
avfilter_init_str() fixed, the AVClass and the options can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
99a200cad8 avfilter/vf_vflip: Remove empty options and AVClass
This filter only had an AVClass and empty options because up until
recently, avfilter_init_str() errored out when options were provided
for a filter without an AVClass. But setting (generic) options is
necessary to take advantage of timeline support. So with
avfilter_init_str() fixed, the AVClass and the options can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
6260d4f770 avfilter/vf_swapuv: Remove empty options and AVClass
This filter only had an AVClass and empty options because up until
recently, avfilter_init_str() errored out when options were provided
for a filter without an AVClass. But setting (generic) options is
necessary to take advantage of timeline support. So with
avfilter_init_str() fixed, the AVClass and the options can be removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
0c800c0b48 avfilter/avfilter: Honour the short options documentation
The documentation for filter arguments states that short options must
precede long options (i.e. those of the form key=value). Yet if
process_options() encounters arguments not abiding by this, it simply
treats short options after a long option as if it were parsing short
options for the first time. In particular, it overwrites options already
set earlier, possibly via other short options. This is not how it is
intended (as a comment in the code indicates).

This commit modifies the code to reject further shorthand options
after a long option has been encountered. After all, avfilter_init_str()
errors out upon unrecognized options, so it is intended to be picky.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
c96d0a0b85 avfilter/avfilter: Use AV_DICT_DONT_STRDUP_(KEY|VAL) when possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-03 19:14:12 +02:00
Andreas Rheinhardt
3ed23dab98 avfilter/vf_spp: Fix left-shift of negative value
Affected the vf-spp FATE-test (on x86 only when MMX
is disabled).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-04-02 00:21:58 +02:00
Andreas Rheinhardt
0e5f71230a avutil/internal: Move avpriv_set_systematic_pal2 decl to imgutils_internal.h
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt
790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt
b616be1649 lib*/version: Use static_assert for static asserts
Also update the checks that guard against inserting
a new enum entry in the middle of a range.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:42 +01:00
Andreas Rheinhardt
a265e8ca92 avcodec, avfilter: Don't use "" for system headers
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:42 +01:00
Marton Balint
2df2b4067e avfilter/buffersrc: fix overriding unknown channel layouts with negotiated one
Fixes ffplay playback of unknown layouts, when SDL directly supports the audio
format, such as:

ffplay -f lavfi anullsrc=cl=2C,aformat=s16

Without the patch, "Channel layout change is not supported" errors are
generated because buffersrc (unknown 2 channel) and buffersink (stereo)
negotiated a stereo layout, but the stereo layout was never stored in the
BufferSourceContext.

This fixes a regression of 7251f90972, but this
is more of a regression of the avfilter channel layout conversion
(1f96db959c).

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-30 20:59:15 +01:00
Anton Khirnov
fa110c32b5 lavfi/setpts: unset frame durations
Actual frame durations are, in general, not computable without buffering
a frame.

FIxes #10886
2024-03-29 09:09:40 +01:00
Anton Khirnov
f121d954ac lavf/vf_setpts: unset output framerate
This filter produces VFR output in general.

Avoids dropping frames in the setpts test.
2024-03-29 09:07:13 +01:00
Michael Niedermayer
3d5f03bbc8
avfilter/vf_signature: Dont crash on no frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-28 18:07:13 +01:00
Niklas Haas
b89ee26539 avfilter: properly reduce YUV colorspace format lists
Doing this with REDUCE_FORMATS() instead of swap_color_*() is not only
shorter, but more importantly comes with the benefit of being done
inside a loop, allowing us to correctly propagate complex graphs
involving multiple conversion filters (e.g. -vf scale,zscale).

The latter family of swapping functions is only used to settle the
best *remaining* entry if no exact match was found, and as such was
never the correct solution to YUV colorspaces, which only care about
exact matches.
2024-03-27 19:11:27 +01:00
Michael Niedermayer
6b213175c9
Bump after 7.0 branch point
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:54 +01:00
Michael Niedermayer
872980ace6
Bump prior release/7.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-03-27 01:04:53 +01:00
Marton Balint
eaca78eff8 avfilter/af_channelmap: add some additional checks for the mappings
- Properly initialize all the mappings to -1 by default.
- Make sure every output channel is assigned exactly once
- Autodetect a native layout when only native channels are present
- Always honor the user specified layout, but make sure the mapping is
  compatible with it

The last item is a regression from 4af412be71.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-24 21:27:55 +01:00
Marton Balint
bba6dd391f avfilter/af_channelmap: factorize checking indexes against a channel layout
Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-24 21:27:55 +01:00
Marton Balint
2f754a96bd avfilter/af_channelmap: disallow channel index 64
MAX_CH is 64, therefore the maximum index is 63.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-24 21:27:55 +01:00
Marton Balint
1bea3e9ee2 avfilter/af_channelmap: fix mapping if in_channel was a string but out_channel was not specified
In this case in_channel_idx was never set and the default 0 was used.
Suprisingly no one noticed that the respective fate test output was wrong.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-24 21:27:55 +01:00
Marton Balint
9a5627ea9a avfilter/af_channelmap: fix error message if FL source channel was missing
FL channel ID is 0, so for an unset value we must check for ID < 0.

Regression since 1f96db959c.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-03-24 21:27:55 +01:00
Henrik Gramner
782c4df28d x86: Avoid using 'd' as an argument name
x86inc.asm adds defines for <argument_name>{b,w,d,q} which clashes with
the nasm d{b,w,d,q} pseudo-instructions for writing initialized data.
2024-03-24 14:53:57 +01:00
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
Timo Rothenpieler
21c6d12449 avfilter/ddagrab: only use acquired texture on valid updates 2024-02-09 19:51:48 +01:00
Andreas Rheinhardt
f6ec01147f avfilter/fifo: Remove (a)fifo filters
Obsolete since 4ca1fb9d2a.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-08 14:02:55 +01:00
Andreas Rheinhardt
1a52cbd404 avfilter/ccfifo: Improve included headers
We don't need to include fifo.h, because we don't need AVFifo
as a complete type. Also add the other used headers directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Andreas Rheinhardt
9b67c5a684 avfilter/ccfifo: Inline trivial functions
Besides being extremly simple this also avoids including
ff_ccfifo_ccdetected() unnecessarily (it is only used by decklink).
This is possible because this is not avpriv, but duplicated into
lavd if necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-02-07 10:22:19 +01:00
Niklas Haas
aa1a194a7e avfilter/vsrc_testsrc: switch to YUV colorspace negotiation API
Instead of overriding the frame properties in fill_picture(), advertise
the supported YUV colorspace and range at format negotiation time. (The
correct metadata will now be set automatically by ff_get_video_buffer)
2024-02-06 11:30:10 +01:00
Niklas Haas
ce81237d63 avfilter: pass link YUV colorspace to ff_draw_init2
This makes all ff_draw_* based filters aware of YUV colorspaces and
ranges. Needed for YUVJ removal. Also fixes a bug where e.g. vf_pad
would generate a limited range background even after conversion to
full-scale grayscale.

The FATE changes were a consequence of the aforementioned bugfix - the
gray scale files are output as full range (due to conversion by
libswscale, which hard-codes gray = full), and appropriately tagged as
such, but before this change the padded version incorrectly used
a limited range (16) black background for these formats.
2024-02-06 11:30:10 +01:00
Niklas Haas
789109ab21 avfilter/vf_tiltandshift: check outlink->color_range
In addition to YUVJ pixfmts.
2024-02-05 15:20:48 +01:00
Marton Balint
52cc89dc45 avfilter/yadif_common: fix timestamps with very small timebases
Yadif filter assumed that the output timebase is always half of the input
timebase. This is not true if halving the input time base is not representable
as an AVRational causing the output timestamps to be invalidly scaled in such a
case.

So let's use av_reduce instead of av_mul_q when calculating the output time
base and if the conversion is inexact then let's fall back to the original
timebase which probably makes more parctical sense than using x/INT_MAX.

Fixes invalidly scaled pts_time values in this command line:
ffmpeg -f lavfi -i testsrc -vf settb=tb=1/2000000000,yadif,showinfo -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint
268062fa15 avfilter/yadif_common: factorize some part of the config_output and the uninit functions
This unifies slightly diverged code and ensures that cc_fifo is always initialized.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Gyan Doshi
94422871fc avfilter/buffersrc: limit link variance logs below debug loglevel
The video param change check will print loglines below debug level
for each frame which is different from the inlink parameters. This
can spam the console. It is now printed at warning level once for
each param change else it is kept at debug level.

Partially addresses #10823
2024-02-01 16:36:18 +05:30
Lynne
5860a966d2
lavfi/vsrc_testsrc_vulkan: fix -Wint-conversion
While VK_NULL_HANDLE is equivalent to NULL on 64-bit platforms, the same is not
true across all platforms.

Fixes building with gcc-14.
2024-01-31 14:26:26 +01:00
Anton Khirnov
0291b6f824 lavfi/vsrc_ddagrab: add an option to avoid duplicating frames
Tested-by: Jiří Eliášek, Misha Aizatulin
2024-01-30 09:32:39 +01:00
Wenbin Chen
d52e8ed114 libavfilter/vf_dnn_detect: Use class confidence to filt boxes
Use class confidence instead of box_score to filt boxes, which is more
accurate. Class confidence is obtained by multiplying class probability
distribution and box_score.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:18:13 +08:00
Wenbin Chen
3de38b9da5 libavfilter/dnn_interface: use dims to represent shapes
For detect and classify output, width and height make no sence, so
change width, height to dims to represent the shape of tensor. Use
layout and dims to get width, height and channel.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:18:06 +08:00
Wenbin Chen
c695de56b5 libavfilter/dnn_bakcend_openvino: Add automatic input/output detection
Now when using openvino backend, user doesn't need to set input/output
names in command line. Model ports will be automatically detected.

For example:
ffmpeg -i input.png -vf \
dnn_detect=dnn_backend=openvino:model=model.xml:input=image:\
output=detection_out -y output.png

can be simplified to:
ffmpeg -i input.png -vf dnn_detect=dnn_backend=openvino:model=model.xml\
 -y output.png

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2024-01-28 11:17:59 +08:00
Anton Khirnov
08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Vladimir Petrov
c915dc4c50
avfilter/vsrc_testsrc: fix colorchart black stripe
Fixed blackstripe on bottom or segmentation fault in case
when patch width and height differ.

Signed-off-by: Vladimir Petrov <vppetrovmms@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-01-12 23:35:40 +01:00
Niklas Haas
bfa1b7577d avfilter/vf_zscale: fix query_formats
Wrong field assignment as a result of copy/paste error.
2024-01-12 14:12:44 +01:00
Marton Balint
363b3ec98a all: use av_channel_layout_describe_bprint instead of av_channel_layout_describe in a few places
Where an AVBPrint buffer is used later anyway.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-01-07 22:47:22 +01:00
Thilo Borgmann
c03c675d89 avfilter/fsync: Fix memory leak
Fixes a leak if s->last_frame is still set at the end of filtering.

Found-by: James Almer
2024-01-07 13:59:02 +01:00
Thilo Borgmann
7ec4835386 avfilter: Add fsync filter 2024-01-05 09:29:05 +01:00
Mark Thompson
8b76bae896 avfilter: Temporary hack to fix format negotiation for hw formats
hw_frames_ctx on the input link is only set when the input link is
configured, which hasn't happened yet.  This temporarily hacks around
the problem (in a way no worse than before the format negotiation
changes) until a proper fix can be applied.
2024-01-04 21:47:38 +00:00
Zhao Zhili
99debe5f82 avfilter/vf_codecview: fix heap buffer overflow
And improve the performance by a little bit.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-05 01:14:33 +08:00
Stefano Sabatini
59686eaf33 lavfi/drawtext: fix missed rename of is_newline
Fix fallout introduced in 732fb122e6, fix compilation with
--enable-libfribidi.
2024-01-03 16:49:16 +01:00
Stefano Sabatini
933c7ff0b9 lavfi/setpts: use macro to access variables array 2024-01-01 20:12:52 +01:00
Stefano Sabatini
030e140145 lavfi: add quirc filter 2024-01-01 20:12:52 +01:00
Stefano Sabatini
899302bb5f lavfi: add qrencode source and filter 2024-01-01 20:12:52 +01:00
Stefano Sabatini
732fb122e6 lavfi: introduce textutils
Generalize drawtext utilities to make them usable in other filters.
This will be needed to introduce the QR code source and filter without
duplicating functionality.
2024-01-01 20:12:52 +01:00
Stefano Sabatini
c2ab41b7e0 lavfi/overlay: factorize definition of planar and packed blending functions 2024-01-01 20:12:52 +01:00
Niklas Haas
44a33fccd8 avfilter/vf_format: allow empty pix_fmts list
Which will impose no restriction. This makes sense when using e.g.
`color_ranges=pc` to limit the color range, without also limiting the
pixel format.
2023-12-31 13:36:22 -08:00
Niklas Haas
796669d483 avfilter/vf_format: add color_ranges/spaces
Needed for fftools/ffmpeg_filter to be able to force specific output
formats via the filter chain.
2023-12-31 13:36:22 -08:00
Niklas Haas
2a942b4b3a avfilter/vf_format: re-use AVFilterFormats for pix_fmt parsing
Rewrite the format parsing code to make it more easily generalizable. In
particular, `invert_formats` does not depend on the type of format list
passed to it, which allows me to re-use this helper in an upcoming
commit.

Slightly shortens the code, at the sole cost of doing several malloc
(ff_add_format) instead of a single malloc.
2023-12-31 13:36:22 -08:00
Niklas Haas
475a99628d avfilter/buffersink: add color space/range accessors
Needed for fftools.
2023-12-31 13:36:12 -08:00
Niklas Haas
e82277b548 avfilter/vf_libplacebo: switch to colorspace negotiation API 2023-12-31 13:35:35 -08:00
Niklas Haas
ff506b8d8f avfilter/vf_libplacebo: don't force dovi frames to bt.2020-ncl
This is at odds with the YUV matrix negotiation API, in which such
dynamic changes in YUV encoding are no longer easily possible. There is
also no really strong motivating reason to do this, since the choice of
YUV matrix is essentially arbitrary and not actually related to the
Dolby Vision decoding process.
2023-12-31 13:35:35 -08:00
Niklas Haas
2ebcbe97fc avfilter/vf_zscale: switch to colorspace negotiation API
Following the same design as vf_scale.
2023-12-31 13:35:35 -08:00
Niklas Haas
3f2c49acfb avfilter/vf_zscale: remove unused variables
Only assigned, never read.
2023-12-31 13:35:35 -08:00
Niklas Haas
45e09a3041 vf_scale: use colorspace negotiation API
This filter will always accept any input format, even if the user sets
a specific in_range/in_color_matrix. This is to preserve status quo with
current behavior, where passing a specific in_color_matrix merely
overrides the incoming frames' attributes. (Use `vf_format` to force
a specific input range)

Because changing colorspace and color_range now requires reconfiguring
the link, we can lift sws_setColorspaceDetails out of scale_frame and
into config_props. (This will also get re-called if the input frame
properties change)
2023-12-31 13:35:35 -08:00
Niklas Haas
2d555dc82d avfilter/buffersrc: add color_space/range parameters
To allow adding proper negotiation, in particular, to fftools.

These values will simply be negotiated downstream for YUV formats, and
ignored otherwise.
2023-12-31 13:35:17 -08:00
Niklas Haas
8c7934f73a avfilter: add negotiation API for color space/range
Motivated by YUVJ removal. This change will allow full negotiation
between color ranges and matrices as needed. By default, all ranges and
matrices are marked as supported.

Because grayscale formats are currently handled very inconsistently (and
in particular, assumed as forced full-range by swscale), we exclude them
from negotiation altogether for the time being, to get this API merged.

After filter negotiation is available, we can relax the
grayscale-is-forced-jpeg restriction again, when it will be more
feasible to do so without breaking a million test cases.

Note that this commit updates one FATE test as a consequence of the
sanity fallback for non-YUV formats. In particular, the test case now
writes rgb24(pc, gbr/unspecified/unspecified) to the matroska file,
instead of rgb24(unspecified/unspecified/unspecified) as before.
2023-12-31 13:35:03 -08:00
Niklas Haas
e687a84854 avfilter/formats: set audio fmt lists for vaf filters
Currently, the logic inside the FF_FILTER_FORMATS_QUERY_FUNC branch
prevents this code from running in the event that we have a filter with
a single video input and a single audio output, as the resulting audio
output link will not have its channel counts / samplerates correctly
initialized to their default values, possibly triggering a segfault
downstream.

An example of such a filter is vaf_spectrumsynth. Although this
particular filter already sets up the channel counts and samplerates as
part of the query function and therefore avoids triggering this bug, the
bug still exists in principle. (And importantly, sets a wrong precedent)
2023-12-31 13:33:01 -08:00
Niklas Haas
0e9cf1abf5 avfilter: always call ff_default_query_formats
Even if a query func is set. This is safe to do, because
ff_default_query_formats is documented not to touch any filter lists
that were already set by the query func.

The reason to do this is because it allows us to extend
AVFilterFormatsConfig without having to touch every filter in existence.
An alternative implementation of this commit would be to explicitly add
a `ff_default_query_formats` call at the end of every query_formats
function, but that would end up functionally equivalent to this change
while touching a whole lot more code paths for no reason.

As a bonus, eliminates some code/logic duplication from this function.
2023-12-31 13:33:01 -08:00
Niklas Haas
1b0ca47707 avfilter/formats: document ff_default_query_formats
In particular, make it clear that this function will not touch format
lists which were already set by the caller before calling into this
function.
2023-12-31 13:32:29 -08:00
Michael Niedermayer
68146f06f8
avfilter/vf_minterpolate: Check pts before division
Fixes: FPE
Fixes: tickets/10758/poc20ffmpeg

Discovered by Zeng Yunxiang

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00