1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

11174 Commits

Author SHA1 Message Date
Philip Langdale
73a2252f1d avfilter/vf_bwdif_cuda: CUDA accelerated bwdif deinterlacer
I've been sitting on this for 3 1/2 years now(!), and I finally got
around to fixing the loose ends and convincing myself that it was
correct. It follows the same basic structure as yadif_cuda, including
leaving out the edge handling, to avoid expensive branching.
2023-06-16 12:52:32 -07:00
Philip Langdale
3c07c2489d avfilter/scale_cuda: add support for rgb32/bgr32 conversions
As we are introducing two new formats and supporting conversions
between them, and also with the existing 0rgb32/0bgr32 formats, we get
a combinatorial explosion of kernels. I introduced a few new macros to
keep the things mostly managable.

The conversions are all simple, following existing patterns, with four
specific exceptions. When converting from 0rgb32/0bgr32 to rgb32/bgr32,
we need to ensure the alpha value is set to 1. In all other cases, it
can just be passed through, either to be used or ignored.
2023-06-16 10:40:21 -07:00
Paul B Mahol
12a073f72c avfilter/buffersrc: stop passing AV_NOPTS_VALUE on EOF 2023-06-16 11:46:09 +02:00
Anton Khirnov
4abf42ab96 lavfi/graphparser: be more verbose when filtergraph parsing fails
When an option could not be found, print its name and value. Note that
this is not done while applying the options in
avfilter_graph_segment_apply_opts() to give the caller the option of
handling the missing options in some other way.
2023-06-16 08:07:02 +02:00
Philip Langdale
ecc3f158e1 avfilter/vf_yadif_cuda: remove unnecessary private struct fields
I'm not sure why I originally did this, but there's no good reason to
put pointers to the cuda context and stream in the priv struct. They
are directly available in the device context that is already being
stored there.
2023-06-15 12:29:52 -07:00
Niklas Haas
d26ea03f60 lavfi/vf_libplacebo: fix typo in assert
Not caught because av_assert1 was compiled out on my end.
2023-06-13 15:28:32 +02:00
Zhao Zhili
32a749c7a6 avfilter/dnn_backend_openvino: fix log message
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:44 +08:00
Zhao Zhili
3a5d95e3fa avfilter/dnn_backend_tf: silence implicit cast warning
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
b0c0fedcda avfilter/dnn_backend_tf: fix use of uninitialized value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
d9f41a343e avfilter/dnn_backend_tf: check TF_OperationOutputType return value
This also fixed a warning: implicit conversion from enumeration
type 'TF_DataType' (aka 'enum TF_DataType') to different
enumeration type 'DNNDataType'.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:24 +08:00
Zhao Zhili
f3495ef4f8 avfilter/dnn_backend_tf: remove unused define
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
e67af9e7f7 avfilter/vf_dnn_processing: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
e7e80e2083 avfilter/vf_dnn_detect: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
a887bc4ff1 avfilter/vf_dnn_classify: replace magic number by enum value
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
016f2f61c3 avfilter/dnn: add log context to ff_get_dnn_module
Print backend type when failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
505c43bb65 avfilter/dnn: refactor ff_get_dnn_module to remove allocation
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Zhao Zhili
3f52b7eedc avfilter/dnn: define each backend as a DNNModule
To avoid export multiple functions for each backend
implementation.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-06-08 10:50:23 +08:00
Paul B Mahol
bfd5090628 avfilter/af_rubberband: rewrite EOF handling
Also pass correct EOF timestamp.
2023-06-08 02:31:19 +02:00
Marvin Scholz
d8c7fea8ef lavfi/vf_blend_vulkan: fix leak on error 2023-06-07 23:59:06 +02:00
Marvin Scholz
dae393fe72 libavfilter: add vf_xfade_vulkan
This is an initial version of vf_xfade_vulkan based
on vf_xfade_opencl, for now only a subset of transitions
are supported.
2023-06-07 23:59:06 +02:00
Marvin Scholz
e62824835d lavfi/vf_xfade: rewrite activate inputs handling
The old code was not properly handling a bunch of edge-cases with
streams terminating earlier and also did not properly report back EOF
to the first input.

This fixes at least one case where the filter could stop doing
anything:

ffmpeg -f lavfi -i "color=blue:d=10" -f lavfi -i "color=aqua:d=0" -filter_complex "[0][1]xfade=duration=2:offset=0:transition=wiperight" -f null -
2023-06-07 08:56:24 +02:00
Paul B Mahol
9a9b56c870 avfilter/vf_mix: add fast filtering in case all tmix weights are same 2023-06-02 18:54:32 +02:00
Paul B Mahol
3cfd85ec20 avfilter/avf_showcqt: switch to activate
And make output frame durations always same.
2023-06-01 20:27:33 +02:00
Paul B Mahol
baa9fccf8d avfilter/vf_mergeplanes: remove hack for linesize calculation 2023-05-31 19:24:03 +02:00
Paul B Mahol
4d9afbeef5 avfilter/avf_aphasemeter: switch to activate 2023-05-30 20:09:47 +02:00
Paul B Mahol
3ea3a4ba16 avfilter/avf_aphasemeter: avoid using double 2023-05-30 20:09:46 +02:00
Paul B Mahol
862ebbf2ed avfilter/avf_abitscope: refactor bit counting for histogram
This helps compiler figure out it can unroll loop and give 4x speedup.
2023-05-30 19:21:13 +02:00
Paul B Mahol
1636fb415a avfilter/avf_ahistogram: refactor frame fill data code 2023-05-30 18:18:14 +02:00
Paul B Mahol
b01cfdb4ab avfilter/avf_showwaves: cleanup and simplify some draw calls 2023-05-30 17:00:30 +02:00
Sami Boukortt
06e8eedeba avfilter/vf_colorspace: fix message for missing/incorrect colorspace
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-05-30 09:05:19 -04:00
Paul B Mahol
81f658b99d avfilter/f_ebur128: set output frame duration
Also produce output video timestamps that are consistent with
10 frames per second.
2023-05-30 14:08:40 +02:00
Paul B Mahol
447bdddeac avfilter/af_afir: do not use ff_outlink_get_status() on inlinks 2023-05-30 14:08:22 +02:00
Paul B Mahol
4ab1184fae avfilter/af_headphone: do not call ff_outlink_get_status() on inlink 2023-05-30 02:16:47 +02:00
Paul B Mahol
492f64de08 avfilter/vf_framepack: remove not needed calls and add newline to log 2023-05-30 02:16:46 +02:00
Paul B Mahol
12acbcb7a2 avfilter/f_graphmonitor: always output last frame on EOF 2023-05-30 02:16:45 +02:00
Paul B Mahol
ac6a6d1abf avfilter/af_join: do not use ff_outlink_get_status() on inlink 2023-05-30 02:16:44 +02:00
Paul B Mahol
51a1124a68 avfilter/avf_showspectrum: do not use ff_outlink_get_status() on inlink 2023-05-30 02:16:42 +02:00
Paul B Mahol
ee664f41db avfilter/avf_showwaves: force output to fixed framerate if rate is set 2023-05-29 20:15:44 +02:00
Niklas Haas
c4cdd79435 lavfi/vf_libplacebo: add corner_rounding option
For what use it may be.
2023-05-29 19:11:18 +02:00
Niklas Haas
098b338369 lavfi/vf_libplacebo: require v5.278 for importing
Importing Vulkan device on older versions no longer works due to the
lavu vulkan API changes (specifically, the switch to planar textures by
default). Additionally, importing on versions that don't suppirt
lock/unlock_queue is unsafe with the advent of the threaded vulkan
hwaccel. As a plus, saves us some annoying #ifdef boilerplate.

I will raise the minimum vf_libplacebo version globally on the next
stable release of libplacebo, and remove all of these checks.
2023-05-29 18:56:56 +02:00
Paul B Mahol
45fa85a777 avfilter/silenceremove_template: refactor detectors using common peaks code 2023-05-29 11:47:11 +02:00
Paul B Mahol
f02964aee1 avfilter/af_silenceremove: add standard deviation detector
Useful in cases audio samples DC offset is not ~0.0, where
other detectors will fail to detect silence.
2023-05-29 11:47:10 +02:00
Paul B Mahol
aa4acc111e avfilter/af_silenceremove: use separate variable for size of cache 2023-05-29 11:47:07 +02:00
Paul B Mahol
364c03d9fe avfilter/silenceremove_template: improve ptp detector 2023-05-29 11:47:06 +02:00
Michael Niedermayer
0c7a0514e3
avfilter/window_func: Use av_bessel_i0()
Old code needed about 6 times as long as new with defaults in afftfilt

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:55:52 +02:00
Michael Niedermayer
1e9c337e0f
avfilter/asrc_sinc: Use av_bessel_i0()
The new function is much more precise
For default beta it is slightly slower, but its speed is already at the
worst case in that comparison
while the replaced function becomes much slower for larger beta

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-05-29 00:55:52 +02:00
Lynne
160a415e22
lavfi: add nlmeans_vulkan filter 2023-05-29 00:42:01 +02:00
Lynne
88e2cca3db
tools/cl2c: change to tools/source2c and allow non-OpenCL source files 2023-05-29 00:42:00 +02:00
Lynne
7cfd7e4af4
lavfi: add color_vulkan filter 2023-05-29 00:42:00 +02:00
Lynne
09dc9193ea
lavfi: add bwdif_vulkan 2023-05-29 00:41:56 +02:00
Niklas Haas
b41ea8c6c3
avfilter/vf_libplacebo: bump max vk version
For two reasons:
1. We now create a vulkan 1.3 device
2. libplacebo master currently requires a vulkan 1.3 device
2023-05-29 00:41:55 +02:00
Niklas Haas
661db605db
avfilter/vf_libplacebo: forward queue locking primitives
For thread safety.
2023-05-29 00:41:55 +02:00
Lynne
f70f873272
transpose_vulkan: port for the rewrite 2023-05-29 00:41:54 +02:00
Lynne
d4b51b5085
scale_vulkan: port for the rewrite 2023-05-29 00:41:54 +02:00
Lynne
8e9ceb1efb
overlay_vulkan: port for the rewrite 2023-05-29 00:41:54 +02:00
Lynne
59f21c051d
gblur_vulkan: port for the rewrite 2023-05-29 00:41:53 +02:00
Lynne
d26cbae3e1
flip_vulkan: port for the rewrite 2023-05-29 00:41:53 +02:00
Lynne
125636608d
chromaber_vulkan: port for the rewrite 2023-05-29 00:41:52 +02:00
Lynne
40bf1d525e
blend_vulkan: port for the rewrite 2023-05-29 00:41:52 +02:00
Lynne
f29850e98f
avgblur_vulkan: port for the rewrite 2023-05-29 00:41:52 +02:00
Lynne
05ce6473ac
lavfi: add lavfi-only Vulkan infrastructure 2023-05-29 00:41:51 +02:00
Lynne
15de0af8f0
vulkan: allow alloc pNext in ff_vk_create_buf 2023-05-29 00:41:45 +02:00
Lynne
b5e333bba7
vulkan: add pNext argument to ff_vk_create_buf() 2023-05-29 00:41:43 +02:00
Paul B Mahol
62d4110a64 avfilter/af_silenceremove: add timestamp option 2023-05-28 12:23:14 +02:00
Paul B Mahol
b95d123097 avfilter/silenceremove_template: revert wrong change 2023-05-28 12:23:13 +02:00
Paul B Mahol
e53260c1f4 avfilter/af_silenceremove: add ptp detector 2023-05-28 12:23:11 +02:00
Paul B Mahol
e8e4863325 avfilter/af_silenceremove: fix the any/all confusion and change default
'any' stop mode is now correctly implemented for end trimming and is of limited usage.
Extend examples and other documentation of this filter.
2023-05-27 16:04:00 +02:00
Paul B Mahol
8d662adcc9 avfilter/af_silenceremove: speed-up filtering once start-trim is over
No point to call filter_start on samples that will pass them unchanged
once initial trimming stopped.
2023-05-27 11:18:02 +02:00
Paul B Mahol
965f99f904 avfilter/af_silenceremove: add timeline support 2023-05-27 11:18:00 +02:00
Paul B Mahol
7927a96e2b avfilter/af_silenceremove: add commands support 2023-05-27 11:17:58 +02:00
Paul B Mahol
5a13b133f8 avfilter/af_silenceremove: add median silence detector 2023-05-27 00:34:37 +02:00
Paul B Mahol
68d0b881de avfilter/silenceremove_template: fix peak detector
The implementation was not working correctly.
2023-05-27 00:34:35 +02:00
Paul B Mahol
29710dd7f2 avfilter/af_silenceremove: speed-up start-only trimming once trim is over 2023-05-26 10:13:37 +02:00
Paul B Mahol
f59d9514da avfilter/silenceremove_template: skip silence start detection after start-only trimming is over 2023-05-26 10:13:37 +02:00
Paul B Mahol
2b5166addf avfilter/af_silenceremove: add real peak detector
Rename old peak detector to more correct name one.
2023-05-26 10:13:37 +02:00
Paul B Mahol
3235de4883 avfilter/af_silenceremove: switch to activate
Do full rewrite, new code is much faster for typical filter usages.
Also previous code was hard to follow and basically very-hard to maintain.
2023-05-26 10:13:37 +02:00
Paul B Mahol
90fba27743 avfilter/trim: switch to activate
This also signals EOF to filter inlink so that unnecessary
extra processing that is immediately dropped by this filter
is not done any more.
2023-05-25 19:52:04 +02:00
Paul B Mahol
a1838c59bb avfilter/af_astats: add abs_peak_count stat 2023-05-25 19:51:39 +02:00
Zhao Zhili
43ace8f2bc avfilter/vf_subtitles: add wrap_unicode option
So CJK can be wrapped automatically.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-05-25 11:31:54 +08:00
Niklas Haas
0bce5590c3 lavfi/vf_libplacebo: fix crop expr PTS calculation
mix->timestamps is expressed relative to the source timebase, which is
possibly a different timescale from `base_pts`. We can't mix-and-match
here. The only reason this worked in my previous testing was because I
was testing on a source file which had an exactly matching timebase.

Fix it by always using the exact PTS as tagged on the AVFrame.
2023-05-24 14:39:40 +02:00
Niklas Haas
d815584755 lavif/vf_libplacebo: move code (cosmetic)
To eliminate need for forward declaration
2023-05-23 15:06:18 +02:00
Niklas Haas
ee13414444 lavfi/vf_libplacebo: update settings after adding hooks
Failure to do so led to the update s->hooks never getting correctly
propagated to the render params.
2023-05-23 15:05:21 +02:00
Marvin Scholz
86b252ea9d avfilter/vf_tpad: accept hardware frames in clone-only mode
When no drawing is to be performed, tpad can work fine with
hardware frames, so advertise this in the query_formats
callback and ensure the drawing context is never initialised
when just cloning frames.

Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Reviewed-by: Niklas Haas <git@haasn.dev>
2023-05-22 18:41:22 +02:00
Marvin Scholz
fa7180b827 avfilter/vf_tpad: use enum for start/stop_mode
Reviewed-by: Thilo Borgmann <thilo.borgmann@mail.de>
Reviewed-by: Niklas Haas <git@haasn.dev>
2023-05-22 18:40:42 +02:00
Paul B Mahol
c37cf59c5b avfilter/vf_xfade: send EOF to first input early
No point to consume 1st input frames any more after crossfade is over.
2023-05-22 17:13:31 +02:00
Niklas Haas
877ccaf776 lavfi/vf_libplacebo: don't intrude on pl_ namespace
No reason to use this prefix here.
2023-05-22 10:31:51 +02:00
Niklas Haas
21715ecff1 lavfi/vf_libplacebo: update peak detection options
Upstream peak detection lost one option and gained one option. Update
code and documentation as required.
2023-05-22 10:31:51 +02:00
Niklas Haas
643cf2ec46 lavfi/vf_libplacebo: update for new tone mapping API
This algorithm has once again been refactored, this time leading to a
dropping of the old `tone_mapping_mode` field, to be replaced by a
single tunable hybrid mode with configurable strength.

We can approximately map the old modes onto the new API for backwards
compatibility. Replace deprecated enums by their integer equivalents to
safely preserve this API until the next bump.
2023-05-22 10:31:50 +02:00
Niklas Haas
d637f20f05 lavfi/vf_libplacebo: switch to new gamut mapping API
Upstream deprecated the old ad-hoc, enum/intent-based gamut mapping API
and added a new API based on colorimetrically accurate gamut mapping
functions.

The relevant change for us is the addition of several new modes, as well
as deprecation of the old options. Update the documentation accordingly.
2023-05-22 10:31:50 +02:00
Niklas Haas
f66280182a lavfi/vf_libplacebo: add RGB colorspace sanity
Explicitly forbid using a non-RGB colorspace with RGB pixel format or
vice versa. This mirrors identical logic from vf_scale.
2023-05-22 10:31:23 +02:00
Niklas Haas
c00fd02558 lavfi/libplacebo: properly handle EOF
The current code relied on pl_queue eventually returning EOF back to the
caller, which didn't work in all situations (e.g. single frame input).
Also, the current code assumed that ff_inlink_acknowledge_status only
fired once, which was patently not true, as the above edge cases
demonstrated.

Solve both issues by keeping track of the acknowledged link status and
forwarding it (instead of trying to probe the pl_queue again) in the
event that we run out of queued input frames, as well as (in CFR mode)
when we pass the indicated status PTS.
2023-05-22 10:31:13 +02:00
Paul B Mahol
7428f1e8f2 avfilter/vf_xfade: fix fadegrays for gbrp* formats
The array elements were left uninitialized.
2023-05-22 09:08:24 +02:00
Paul B Mahol
6284afec07 avfilter/vf_xfade: avoid some not needed dereferencing in inner loops 2023-05-22 08:42:06 +02:00
Paul B Mahol
0709680fc4 avfilter/vf_xfade: add horizontal and vertical wind transforms 2023-05-22 08:42:06 +02:00
Paul B Mahol
e684967e74 avfilter/f_graphmonitor: output one frame more after eof
To easily debug eof issues.
2023-05-21 22:06:55 +02:00
Paul B Mahol
c4b3e882f8 avfilter/f_graphmonitor: make opacity runtime option 2023-05-21 14:56:30 +02:00
Paul B Mahol
08eb13c05c avfilter/f_graphmonitor: add missing queue flag 2023-05-21 14:56:29 +02:00
Paul B Mahol
416c1e62f1 avfilter/f_graphmonitor: cache strlen() values 2023-05-21 14:56:27 +02:00
Paul B Mahol
f055345595 avfilter/f_graphmonitor: speed-up clear_image() 2023-05-21 14:56:26 +02:00
Kacper Michajłow
1aeefc4c06 lavfi/vf_libplacebo: allow linking to shared library with dllimport
Address of dll imported variables can't be used for constant
initialization in C language modes.
2023-05-21 13:15:28 +02:00
Paul B Mahol
65fe18040a avfilter/f_graphmonitor: add flags option shortcuts 2023-05-21 13:02:02 +02:00
Paul B Mahol
b528e098a9 avfilter/f_graphmonitor: show also current timeline status of filter 2023-05-21 13:01:59 +02:00
Paul B Mahol
5fe6a0e5c7 avfilter/src_movie: switch to activate 2023-05-21 10:49:41 +02:00
Paul B Mahol
3546f70410 avfilter/src_movie: dr support 2023-05-21 10:49:30 +02:00
James Almer
d55743c809 avfilter/af_surround: replace double constants with float variants
This is cleaner than the approach in d1ded7310a.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-19 17:12:04 -03:00
Paul B Mahol
613f716450 avfilter/vf_mix: improve speed even more by avoiding using filter private context 2023-05-19 19:32:22 +02:00
Paul B Mahol
4c695bfa65 avfilter/f_graphmonitor: make mode option of type flags 2023-05-18 18:12:42 +02:00
Paul B Mahol
8cdbe3abb6 avfilter/f_graphmonitor: add commands support 2023-05-18 18:12:42 +02:00
Paul B Mahol
386de9319e avfilter/f_graphmonitor: add nozeroeof mode 2023-05-18 18:12:42 +02:00
Paul B Mahol
01d9a84ef5 avfilter/avf_showspectrum: check for allocation error 2023-05-18 12:06:38 +02:00
Paul B Mahol
2a74826b02 avfilter/*xfade: reduce memory consumption
There is no always need for new buffers.
2023-05-14 23:35:50 +02:00
Paul B Mahol
66175c2dca avfilter/f_graphmonitor: set output frame duration 2023-05-14 20:58:08 +02:00
Paul B Mahol
932ccf9e7d avfilter/f_loop: free video frames once not needed 2023-05-14 20:58:08 +02:00
Paul B Mahol
c27895bb98 avfilter/f_graphmonitor: add nozero display mode 2023-05-14 20:58:08 +02:00
Paul B Mahol
6eecfc577b avfilter/f_graphmonitor: rename enums 2023-05-14 20:58:08 +02:00
Paul B Mahol
8041d00271 avfilter/f_loop: fix looping for aloop 2023-05-14 20:58:07 +02:00
Paul B Mahol
7a63add0ea avfilter/f_loop: add time option, for loop start in seconds 2023-05-14 20:58:07 +02:00
Niklas Haas
30c71ef98e lavfi/vf_libplacebo: add frame_mixer option
Fairly straightforward. We just need to modify the scaler handling code
slightly to support looking at a different list of filter presets.
2023-05-14 11:21:43 +02:00
Niklas Haas
02f3b9312a lavfi/vf_libplacebo: allow fps conversion
This exposes libplacebo's frame mixing functionality to vf_libplacebo,
by allowing users to specify a desired target fps to output at. Incoming
frames will be smoothly resampled (in a manner determined by the
`frame_mixer` option, to be added in the next commit).

To generate a consistently timed output stream, we directly use the
desired framerate as the timebase, and simply output frames in
sequential order (tracked by the number of frames output so far).
2023-05-14 11:21:43 +02:00
Niklas Haas
83b1f3f54e lavfi/vf_libplacebo: switch to activate()
To present compatibility with the current behavior, we keep track of a
FIFO of exact frame timestamps that we want to output to the user. In
practice, this is essentially equivalent to the current filter_frame()
code, but this design allows us to scale to more complicated use cases
in the future - for example, insertion of intermediate frames
(deinterlacing, frame doubling, conversion to fixed fps, ...)
2023-05-14 11:21:43 +02:00
Niklas Haas
9e802a47cc lavfi/vf_libplacebo: switch to pl_queue-based design
This does not leverage any immediate benefits, but refactors and
prepares the codebase for upcoming changes, which will include the
ability to do deinterlacing and resampling (frame mixing).
2023-05-14 11:21:43 +02:00
Niklas Haas
2d5e137207 lavfi/vf_libplacebo: split and refactor logic
This commit contains no functional change. The goal is merely to
separate the highly intertwined `filter_frame` and `process_frames`
functions into their separate concerns, specifically to separate frame
uploading (which is now done directly in `filter_frame`) from emitting a
frame (which is now done by a dedicated function `output_frame`).

The overall idea here is to be able to ultimately call `output_frame`
multiple times, to e.g. emit several output frames for a single input
frame.
2023-05-14 11:21:43 +02:00
Niklas Haas
482d81378f lavfi/vf_libplacebo: update render params on demand
Only update this struct when it's expected to change, and cache it
otherwise. Partially motivated by a desire to make `process_frames`
smaller.
2023-05-14 11:15:49 +02:00
Oleg
e700d87b20 avfilter/setpts: add command support
Add support for changing expr on the fly.

Signed-off-by: Oleg <oafanasiev@gmail.com>
2023-05-14 11:10:50 +02:00
Paul B Mahol
28a73506df avfilter/vf_waveform: add input option
For finer control of selected formats for filtering.
2023-05-14 00:13:59 +02:00
Paul B Mahol
fb8efa9793 avfilter/avfiltergraph: remove no longer valid comment 2023-05-14 00:13:52 +02:00
James Almer
b446ea22e9 avfilter/formats: fix format negotiation when multiple channel_layouts are provided
For example
ffmpeg -f lavfi -i sine -af "aformat=cl=stereo|5.1|7.1,lowpass,aformat=cl=7.1|5.1|stereo" -f null -

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-13 18:21:29 -03:00
Niklas Haas
c65e481330 lavfi/vf_libplacebo: allow operation without avhwdevice
Recent versions of libplacebo have required Vulkan versions incompatible
with lavu Vulkan hwcontexts. While this is expected to change
eventually, breaking vf_libplacebo every time there is such a transition
period is obviously undesired behavior, as the following sea of bug
reports shows.

This commit adds a fallback path for init_vulkan failures which simply
creates an internal device if there was no user-supplied Vulkan hwaccel.
Useful when no interop with lavu vulkan hwframes is needed or desired,
and makes using this filter easier inside certain applications.

Fixes: https://github.com/haasn/libplacebo/issues/170
Fixes: https://github.com/mpv-player/mpv/issues/9589#issuecomment-1535432185
Fixes: https://github.com/mpv-player/mpv/issues/11363
Fixes: https://github.com/mpv-player/mpv/issues/11685#issuecomment-1546627082
Closes: https://code.videolan.org/videolan/libplacebo/-/issues/270
2023-05-13 17:38:20 +02:00
Paul B Mahol
e076d8a9b3 avfilter/af_asetrate: extend query_formats()
It left some formats not defined. Causing format negotiation
errors with ffplay.

Fixes #9248
2023-05-13 10:58:48 +02:00
Paul B Mahol
ee6ef66d65 avfilter/avfiltergraph: fix check for negative return
Before this commit if allocation would fail in ff_add_channel_layout()
function, function would return negative error code and this would
cause wrong format pick up later. If allocation would not fail return
code would be 0 and then format negotiation would simply fail as code
would break from the loop but with wrong return code.

Error was introduced in 6aaac24d72 commit.

Fixes #6638
2023-05-13 10:58:46 +02:00
James Almer
8564b4ab05 avfilter/ccfifo: constify some parameters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-12 22:33:16 -03:00
Paul B Mahol
e65f03ca13 avfilter/af_loudnorm: simplify query_formats even more 2023-05-12 22:44:54 +02:00
James Almer
7f890b2fbb avfilter/ccfifo: remove unnecessary context allocations
This is not public API, no it has no need for an alloc() and free()
functions. The struct can reside on stack.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-12 16:21:18 -03:00
Paul B Mahol
cb4e7831e7 avfilter/af_surround: scale output gain for non-default overlap 2023-05-12 12:33:33 +02:00
Paul B Mahol
09cd89df27 avfilter/af_surround: cache constant rdft_size inside loops 2023-05-12 12:33:33 +02:00
Paul B Mahol
d1ded7310a avfilter/af_surround: reduce double usage 2023-05-11 20:14:46 +02:00
Paul B Mahol
f013650243 avfilter/avf_showwaves: zero whole allocated chunk 2023-05-11 20:14:46 +02:00
Timo Rothenpieler
869c06886d avfilter/vf_yadif_cuda: fix build
Identical patches were sent by Leo Izen and Devin Heitmueller.
2023-05-11 19:24:55 +02:00
Devin Heitmueller
0e12cdc69c avfilter/vf_ccrepack: Add new filter to repack CEA-708 side data
THis filter can correct certain issues seen from upstream sources
where the cc_count is not properly set or the CEA-608 tuples are
not at the start of the payload as expected.

Make use of the ccfifo to extract and immediately repack the CEA-708
side data, thereby removing any extra padding and ensuring the 608
tuples are at the front of the payload.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
Devin Heitmueller
f304c3a729 avfilter/tinterlace: Properly preserve CEA-708 closed captions
Because the interlacing filter halves the effective framerate, we
need to ensure that no CEA-708 data is lost as frames are merged.

Make use of the new ccfifo mechanism to ensure that caption data
is properly preserved as frames pass through the filter.

Thanks to Thomas Mundt for review and noticing a couple of
missed codepaths for injection on output.  Thanks to Lance Wang
for pointing out a memory leak.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
Devin Heitmueller
cecf35ae3e avfilter/yadif: Properly preserve CEA-708 closed captions
Various deinterlacing modes have the effect of doubling the
framerate, and we need to ensure that the caption data isn't
duplicated (or else you get double captions on-screen).

Use the new ccfifo mechanism for yadif (and yadif_cuda and bwdif
since they use the same yadif core) so that CEA-708 data is
properly preserved through this filter.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
Devin Heitmueller
61a9f3c0ce avfilter/vf_fps: properly preserve CEA-708 captions
The existing implementation made an attempt to remove duplicate
captions if increasing the framerate, but made no attempt to
handle reducing the framerate, nor did it rewrite the caption
payloads to have the appropriate cc_count (e.g. the cc_count needs
to change from 20 to 10 when going from 1080i59 to 720p59 and
vice-versa).

Make use of the new ccfifo mechanism to ensure that caption data
is properly preserved.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
Devin Heitmueller
2b0e794ffc avfilter/ccfifo: Properly handle CEA-708 captions through framerate conversion
When transcoding video that contains 708 closed captions, the
caption data is tied to the frames as side data.  Simply dropping
or adding frames to change the framerate will result in loss of
data, so the caption data needs to be preserved and reformatted.

For example, without this patch converting 720p59 to 1080i59
would result in loss of 50% of the caption bytes, resulting in
garbled 608 captions and 708 probably wouldn't render at all.
Further, the frames that are there will have an illegal
cc_count for the target framerate, so some decoders may ignore
the packets entirely.

Extract the 608 and 708 tuples and insert them onto queues.  Then
after dropping/adding frames, re-write the tuples back into the
resulting frames at the appropriate rate given the target
framerate.  This includes both having the correct cc_count as
well as clocking out the 608 pairs at the appropriate rate.

Thanks to Lance Wang <lance.lmwang@gmail.com>, Anton
Khirnov <anton@khirnov.net>, and Michael Niedermayer <michael@niedermayer.cc>
for providing review/feedback.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
Paul B Mahol
0412e1dc80 avfilter/vsrc_testsrc: mark zoneplate as full range 2023-05-10 16:42:00 +02:00
Paul B Mahol
5b300b69a6 avfilter/af_pan: free input frame once unneeded 2023-05-10 14:01:49 +02:00
Paul B Mahol
2de30e7f8c avfilter/af_join: fix leak on error 2023-05-10 13:56:34 +02:00
Paul B Mahol
ffd275a7e0 avfilter/af_pan: fix leaks on error case 2023-05-10 13:56:34 +02:00
Paul B Mahol
dc1d4a8ece avfilter/src_avsynctest: add support for commands 2023-05-10 12:55:22 +02:00
Paul B Mahol
5e7042fa31 avfilter/src_avsynctest: fix beep amplitude scaling 2023-05-10 12:55:21 +02:00
Paul B Mahol
512bba3d1b avfilter/vf_varblur: add float format support 2023-05-09 21:46:38 +02:00
Paul B Mahol
57f264e78c avfilter/vf_estdif: simplify finding minimum score 2023-05-09 12:12:46 +02:00
Paul B Mahol
16a86b443d avfilter/vf_estdif: remove float usage 2023-05-09 12:12:46 +02:00
Paul B Mahol
54353ce88e avfilter/vf_estdif: fix recently introduced regression 2023-05-09 12:10:04 +02:00
Paul B Mahol
3475c8342c avfilter: add zoneplate video test source 2023-05-09 08:48:44 +02:00
Paul B Mahol
086a0f3e5e avfilter/asrc_anoisesrc: improve velvet noise output 2023-05-09 00:42:36 +02:00
Paul B Mahol
90096dd042 avfilter/vf_feedback: fix artifacts with subsampled chroma 2023-05-09 00:42:18 +02:00
Thilo Borgmann
21a0b6bca8 avfilter/vf_mpdecimate: Add option to keep the first N similar frames before dropping
This allows for decimating large similar portions of a video while preserving small ones.
2023-05-08 21:55:53 +02:00
Paul B Mahol
1eed7f6562 avfilter/vf_morpho: add slice threading support 2023-05-08 17:48:43 +02:00
Paul B Mahol
df886171a6 avfilter/vf_morpho: remove unused function's argument 2023-05-08 17:48:43 +02:00
Paul B Mahol
bbe410a7fd avfilter/vf_morpho: move structure processing in separate loop 2023-05-08 17:48:43 +02:00
Paul B Mahol
1c8bf697ee avfilter/f_ebur128: export results into read-only options 2023-05-07 17:28:25 +02:00
Paul B Mahol
7153642992 avfilter/af_replaygain: export results into read-only options 2023-05-07 17:25:57 +02:00
Paul B Mahol
782ea8b2e5 avfilter/af_asetnsamples: add timeline support 2023-05-07 17:25:07 +02:00
Paul B Mahol
03800bcaf3 avfilter/af_asetnsamples: add commands support 2023-05-07 17:25:02 +02:00
Paul B Mahol
55ea1da1c0 avfilter/adynamicequalizer_template: remove empty lines 2023-05-06 17:50:05 +02:00
Paul B Mahol
0c91327210 avfilter/vsrc_gradients: fix several issues with !rgba output 2023-05-06 17:49:43 +02:00
Paul B Mahol
24f16b798e avfilter/af_join: set output frame duration 2023-05-05 17:20:14 +02:00
Paul B Mahol
67ca64c24b avfilter/af_adelay: fix frame pts and set frame duration 2023-05-05 17:20:14 +02:00
Paul B Mahol
217bb59f2e avfilter/af_amerge: set output frame duration 2023-05-05 17:20:13 +02:00
Paul B Mahol
6f1c82fd5b avfilter/af_biquads: reduce double type usage 2023-05-05 17:20:13 +02:00
James Almer
6febb2a5ff avfilter/vf_coreimage: add missing semicolon
Fixes compilation after af8db9106c.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 22:38:47 -03:00
James Almer
3e06f6f040 avutil/frame: deprecate key_frame
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:20:03 -03:00
James Almer
af8db9106c avfilter: use the new AVFrame key_frame flag in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 19:19:13 -03:00
James Almer
599abc0f3a avutil/frame: deprecate interlaced_frame and top_field_first
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer
36827ea783 avfilter: use the new AVFrame interlace flags in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:11 -03:00
Niklas Haas
b80e43bf07 avfilter/vf_libplacebo: add flexible crop exprs
Motivated by a desire to use vf_libplacebo as a GPU-accelerated
cropping/padding/zooming filter. This commit adds support for setting
the `input/target.crop` fields as dynamic expressions.

Re-use the same generic variables available to other scale and crop type
filters, and also add some more that we can afford as a result of being
able to set these properties dynamically.

It's worth pointing out that `out_t/ot` is currently redundant with
`in_t/t` since it will always contain the same PTS values, but I plan on
changing this in the near future.

I decided to also expose `crop_w/crop_h` and `pos_w/pos_h` as variables
in the expression parser itself, since this enables the fairly common
use case of determining dimensions first and then placing the image
appropriately, such as is done in the default behavior (which centers
the cropped/placed region by default).
2023-05-03 23:40:20 +02:00
Niklas Haas
4b11a07550 avfilter/vf_libplacebo: add fillcolor option
In some circumstances, libplacebo will clear the background as a result
of cropping/padding. Currently, this uses the hard-coded default fill
color of black. This option makes this behavior configurable.
2023-05-03 23:40:20 +02:00
Paul B Mahol
d94c6df975 avfilter/af_afreqshift: cache nb_coeffs value 2023-05-03 20:13:26 +02:00
Paul B Mahol
5617465916 avfilter/af_anlms: improve documentation and extend option 2023-05-01 20:07:06 +02:00
Paul B Mahol
f09280dfc4 avfilter/af_arls: improve documentation and extend option 2023-05-01 20:07:05 +02:00
James Almer
159f8b8d71 avfilter/audio: move a variable declaration outside of an unrelated deprecated block
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-01 13:57:09 -03:00
Paul B Mahol
eaf15b5882 avfilter/vf_waveform: cc2b3201e7 missed same for >8 bits 2023-05-01 14:55:32 +02:00
Paul B Mahol
7b2851b290 avfilter/af_asdr: add support for threads 2023-04-30 12:38:02 +02:00
Paul B Mahol
4f63e049a2 avfilter/af_asdr: add timeline support 2023-04-30 12:38:02 +02:00
Paul B Mahol
a47bd6d3d8 avfilter/af_asdr: set output frame duration 2023-04-30 12:38:02 +02:00
Paul B Mahol
a2f4adf680 avfilter: add arls filter 2023-04-30 11:34:35 +02:00
Paul B Mahol
f247a3d82d avfilter/af_adynamicequalizer: add precision option 2023-04-30 11:32:45 +02:00
Paul B Mahol
5564ba49a1 avfilter/af_adynamicequalizer: refactor code to gain small speedup 2023-04-28 23:31:25 +02:00
Paul B Mahol
153aaae457 avfilter/af_adynamicequalizer: factor detection filter code 2023-04-28 23:31:25 +02:00
Paul B Mahol
51504cf279 avfilter/af_adynamicequalizer: add dftype option
Useful for filter selection for detection control.
2023-04-28 23:31:25 +02:00
Ting Fu
78f95f1088 lavfi/dnn: Remove DNN native backend
According to discussion in
https://etherpad.mit.edu/p/FF_dev_meeting_20221202 and the proposal in
http://ffmpeg.org/pipermail/ffmpeg-devel/2022-December/304534.html,
the DNN native backend should be removed at first step.
All the DNN native backend related codes are deleted.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-04-28 11:07:41 +08:00
Ting Fu
a9fb141719 lavfi/dnn: Modified DNN native backend related tools and docs.
Will remove native backend, so change the default backend in filters,
and also remove the python scripts which generate native model file.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-04-28 11:07:41 +08:00
Ting Fu
7ed6f28a7c lavfi/dnn: modify dnn interface for removing native backend
Native backend will be removed in following commits, so change the
dnn interface and modify the error message in it first.

Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-04-28 11:07:40 +08:00
Paul B Mahol
4e57a0f35a avfilter/afir_template: avoid multiplications if memcpy is enough 2023-04-27 22:53:13 +02:00
Paul B Mahol
19148a5b9f avfilter: add FIR equalizer coefficients source filter 2023-04-27 21:45:57 +02:00
Niklas Haas
e3143703e9 avfilter/vf_libplacebo: strip ICC profiles on CSP change
Not doing so is an obvious oversight - the ICC profile is tied to the
original colorspace, so if we change it, we should definitely strip this
information.

We should probably also have an extra option to control whether the ICC
profile should be stripped, ignored, or applied, but for now this fixes
an existing bug.
2023-04-26 15:36:10 +02:00
Paul B Mahol
8b0ec740cb avfilter/af_afir: fix remaining artifacts on IR switch 2023-04-25 21:22:15 +02:00
Paul B Mahol
bee265e5d5 avfilter/af_afir: add way to control loading interval of impulses 2023-04-25 21:22:15 +02:00
Paul B Mahol
1835f884b7 avfilter/af_afir: make IR switching work also with minp != maxp 2023-04-25 21:22:15 +02:00
Paul B Mahol
a0cb29261c avfilter/af_afir: cache xfade coefficients 2023-04-24 22:30:55 +02:00
Anton Khirnov
cd30492773 lavfi/avf_concat: rescale frame durations 2023-04-24 16:56:06 +02:00
Haihao Xiang
2aad9765ef lavfi/overlay_vaapi: set input region for overlay video to NULL
Otherwise main and overlay videos share the same input region. Note NULL
pointer imples the whole overlay video will be processed.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-04-24 13:24:41 +08:00
Paul B Mahol
ef338cfd7b avfilter/af_afir: fix IR switching with different lengths 2023-04-23 23:40:42 +02:00
Paul B Mahol
014c02d43b avfilter/af_anlms: simplify query formats 2023-04-22 18:12:47 +02:00
Anton Khirnov
e392674399 lavfi: ensure audio frame durations match the sample count 2023-04-19 21:12:03 +02:00
Stefano Sabatini
9d140ecaf8 lavfi/unsharp: clarify invalid filter param constraints
Clarify failure in case of x/y building a too big matrix.

Example:
$ ffmpeg -hide_banner -f lavfi -i color=c=white:size=640x360,unsharp=lx=5:ly=23 -f null -t 1 -
[Parsed_unsharp_1 @ 0x5650e1c30240] luma matrix size (lx/2+ly/2)*2=26 greater than maximum value 25
color=c=white:size=640x360,unsharp=lx=5:ly=23: Invalid argument

Fix trac issue:
http://trac.ffmpeg.org/ticket/6033
2023-04-02 17:07:51 +02:00
Haihao Xiang
412d43b09a lavfi/vf_vpp_qsv: only add the given output sw format to output pad
Otherwise the output format is not changed when output is in system
memory. For example, the output format is still p010le in the following
case:

$ ffmpeg -qsv_device /dev/dri/renderD128 -f lavfi -i testsrc -vf
"format=p010le,vpp_qsv=extra_hw_frames=8:format=nv12" -f null -
...
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf60.4.100
  Stream #0:0: Video: wrapped_avframe, p010le(tv, progressive), 320x240
[SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-03-31 10:27:58 +08:00
Paul B Mahol
b75159682a avfilter/af_rubberband: use correct array for multichannels 2023-03-30 14:08:52 +02:00
Stefano Sabatini
7d58df7bb2 lavfi/aspect: apply style fixes 2023-03-29 00:15:19 +02:00
U. Artie Eoff
9bf1848acf lavfi: add hwdevice flag to hwupload/hwmap
This fixes a regression introduced by:

  commit 3f63685c35
   and
  commit 632c349931

...where command-lines like:

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt yuv420p \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12,hwupload=extra_hw_frames=120' \
  -an -c:v h264_qsv -y output.h264

ffmpeg -v verbose -hwaccel qsv \
  -init_hw_device qsv=qsv,child_device=/dev/dri/renderD128 \
  -hwaccel_output_format qsv -f rawvideo -pix_fmt nv12 \
  -s:v 352x288 -r:v 25 -i input.yuv \
  -vf 'format=nv12|qsv,hwupload=extra_hw_frames=16,vpp_qsv=procamp=1:saturation=1.0,hwdownload,format=nv12' \
  -pix_fmt nv12 -f rawvideo -fps_mode passthrough -an -y output.yuv

...produced errors like:

[hwupload @ 0x55b6171d0dc0] A hardware device reference is required to upload frames to.
[Parsed_hwupload_1 @ 0x55b6172053c0] Query format failed for 'Parsed_hwupload_1': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-03-27 17:14:31 +02:00
Ting Fu
bc589c91f7 lavfi/dnn: add error info for TF backend filling task failure
Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-03-26 09:19:42 +08:00
Ting Fu
af052f9066 lavfi/dnn: fix mem leak in TF backend error handle
Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-03-26 09:19:42 +08:00
Ting Fu
5c216d081d lavfi/dnn: fix corruption when TF backend infer failed
Signed-off-by: Ting Fu <ting.fu@intel.com>
2023-03-26 09:19:42 +08:00
Michael Niedermayer
06b451d276
avfilter/vf_mcdeint: update to new API
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-26 01:46:49 +01:00
Michael Niedermayer
5310c975cf
avfilter/vf_uspp: add AV_CODEC_FLAG_RECON_FRAME support
about 50% faster (based on command line fps)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-26 01:46:49 +01:00
James Almer
aca8ceb870 x86/vf_bwdif_init: limit AVX2 functions using 256bit vectors to cpus known to be fast with it
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-25 13:27:20 -03:00
Jun Zhao
9a23d8d894 lavfi/Makefile: fix make checkheaders fail
Add stack_internal.h to the list of skipped headers to fix
make checkheaders fail, it's introduced by commit 742dfa281

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-03-25 22:13:56 +08:00
James Darnley
073ec3b9da avfilter/bwdif: add avx2 filter_line function
8-bit:
2.24x faster (1925±1.3 vs. 859±2.2 decicycles) compared with ssse3
10-bit:
2.00x faster (1703±1.7 vs. 853±2.0 decicycles) compared with ssse3
2023-03-25 02:38:17 +01:00
James Darnley
b503b5a0cf avfilter/bwdif: move filter_line init to a dedicated function 2023-03-25 02:38:17 +01:00
Anton Khirnov
632c349931 lavfi: add a flag for filters able to work with hw_device_ctx
This way the caller can set it just on the filters that can make use of
it.
2023-03-24 10:16:51 +01:00
Anton Khirnov
27f8c9b27b lavu/frame: deprecate AVFrame.pkt_{pos,size}
These fields are supposed to store information about the packet the
frame was decoded from, specifically the byte offset it was stored at
and its size.

However,
- the fields are highly ad-hoc - there is no strong reason why
  specifically those (and not any other) packet properties should have a
  dedicated field in AVFrame; unlike e.g. the timestamps, there is no
  fundamental link between coded packet offset/size and decoded frames
- they only make sense for frames produced by decoding demuxed packets,
  and even then it is not always the case that the encoded data was
  stored in the file as a contiguous sequence of bytes (in order for pos
  to be well-defined)
- pkt_pos was added without much explanation, apparently to allow
  passthrough of this information through lavfi in order to handle byte
  seeking in ffplay. That is now implemented using arbitrary user data
  passthrough in AVFrame.opaque_ref.
- several filters use pkt_pos as a variable available to user-supplied
  expressions, but there seems to be no established motivation for using them.
- pkt_size was added for use in ffprobe, but that too is now handled
  without using this field. Additonally, the values of this field
  produced by libavcodec are flawed, as described in the previous
  ffprobe conversion commit.

In summary - these fields are ill-defined and insufficiently motivated,
so deprecate them.
2023-03-20 10:42:09 +01:00
Haihao Xiang
57afccc0ef lavfi/vf_vpp_qsv: set the right timestamp for AVERROR_EOF
Rescale the timestamp for AVERROR_EOF. This can fix tickets 10261 and
10262.

Tested-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-03-20 09:58:41 +08:00
Michael Niedermayer
3ead1fe413
avfilter/vf_uspp: about 10x the speed with threads
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 22:36:51 +01:00
Michael Niedermayer
cee4b99d41
avfilter/vf_uspp: Support any codec
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 18:20:14 +01:00
Michael Niedermayer
771c27119d
avfilter/vf_uspp: update to new APIs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-03-18 18:20:02 +01:00
Zhao Zhili
4ec2861559 avfilter/vf_showinfo: fix HDR vivid info
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-03-17 18:52:12 +08:00
James Almer
dc61d5cf19 avfilter/vf_untile: swap the chroma shift values used for plane offsets
Fixes ticket #10265

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-16 16:07:40 -03:00
Andreas Rheinhardt
2732d0507c avfilter/vf_ssim360: Remove dead code
Fixes Coverity issue #1520669.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-03-14 07:16:45 +01:00
Andreas Rheinhardt
1091963d38 avfilter/vf_ssim360: Use correct type in sizeof
SSIM360Context.ssim360_hist is an array of four pointers to double;
so sizeof(*ssim360_hist[0]) (=sizeof(double)) is the correct size
to use to calculate the amount of memory to allocate, not
sizeof(*ssim360_hist) (which is sizeof(double*)).

Use FF_ALLOCZ_TYPED_ARRAY to avoid this issue altogether.

Fixes Coverity issue #1520671.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-03-14 07:16:06 +01:00
Niklas Haas
1231003c3c avfilter/vf_libplacebo: remove deprecated field
This has not been functional since a year ago, including in our current
minimum dependency of libplacebo (v4.192.0). It also causes build errors
against libplacebo v6, so it needs to be removed from the code. We can
keep the option around for now, but it should also be removed soon.

Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-13 11:30:58 -03:00
Niklas Haas
11eca6018c avfilter/vf_libplacebo: wrap deprecated opts in FF_API define
Signed-off-by: Niklas Haas <git@haasn.dev>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-13 11:30:58 -03:00
James Almer
358588c820 Revert "avfilter/stack_internal: add missing header includes"
This reverts commit 205117d87f.

This didn't fix make checkheaders after all, and also broke compilation in some
scenarios.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-11 10:05:47 -03:00
James Almer
205117d87f avfilter/stack_internal: add missing header includes
Fixes make checkheaders

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-10 16:27:05 -03:00
Anton Khirnov
fefcba1c1b lavfi/graphparser: use correct logging context 2023-03-10 13:04:25 +01:00
James Almer
2fd86d9afa avfilter/graphparser: fix filter instance name when an id is provided
Restores the behavior of naming the instance filter@id, which was accidentally changed
to simpy id in commit f17051eaae.

Fixes ticket #10226.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-03-06 08:42:18 -03:00
Stefano Sabatini
ad17e29224 lavfi/buffersrc: issue more specific error in case of invalid parameters 2023-03-05 12:21:45 +01:00
James Almer
4561232b1a avfilter/af_pan: use the new swr used channel layout option
Fixes ticket #10180

Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-19 18:28:52 -03:00
Michael Niedermayer
47ac3e6065
version.h: Bump minor post 6.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-19 18:37:36 +01:00
Michael Niedermayer
62efa096af
version.h: Bump minor for 6.0 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-02-19 18:32:07 +01:00
Niklas Haas
eabc304d12 avfilter/vf_libplacebo: add SMPTE ST2094 tone-mappers
libplacebo gained these exciting new functions upstream.
2023-02-17 18:35:39 +01:00
Wenbin Chen
b7a335c5e9 libavfilter/qsvvpp: check the return value
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-02-16 11:15:50 +08:00
Haihao Xiang
0f407cdea2 avfilter: add QSV variants of the stack filters
Include hstack_qsv, vstack_qsv and xstack_qsv. They may accept input
streams with different sizes.

Examples:
$ ffmpeg -hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][0:v]hstack_qsv" -f null -

$ ffmpeg \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-hwaccel qsv -hwaccel_output_format qsv -i input.mp4 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_qsv=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-16 11:15:50 +08:00
Haihao Xiang
742dfa2815 lavfi/vf_stack_vaapi: factor out the common code for stack setting
The common code will be used in QSV based stack filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-16 11:15:41 +08:00
Kieran Kunhya
264cf75214 vf_yadif: Remove unused emms_c 2023-02-14 19:09:19 +00:00
Paul B Mahol
e506ea3ce1 avfilter: use ff_inlink_make_frame_writable() 2023-02-12 13:32:00 +01:00
Anton Khirnov
f17051eaae lavfi/graphparser: reimplement avfilter_graph_parse* using new API 2023-02-12 10:33:52 +01:00
Anton Khirnov
d1b9a3ddb4 lavfi: add a new filtergraph parsing API
Callers currently have two ways of adding filters to a graph - they can
either
- create, initialize, and link them manually
- use one of the avfilter_graph_parse*() functions, which take a
  (typically end-user-written) string, split it into individual filter
  definitions+options, then create filters, apply options, initialize
  filters, and finally link them - all based on information from this
  string.

A major problem with the second approach is that it performs many
actions as a single atomic unit, leaving the caller no space to
intervene in between. Such intervention would be useful e.g. to
- modify filter options;
- supply hardware device contexts;
both of which typically must be done before the filter is initialized.

Callers who need such intervention are then forced to invent their own
filtergraph parsing, which is clearly suboptimal.

This commit aims to address this problem by adding a new modular
filtergraph parsing API. It adds a new  avfilter_graph_segment_parse()
function to parse a string filtergraph description into an intermediate
tree-like representation (AVFilterGraphSegment and its children).

This intermediate form may then be applied step by step using further
new avfilter_graph_segment*() functions, with user intervention possible
between each step.
2023-02-12 10:28:06 +01:00
Anton Khirnov
4310b66b98 lavfi/avfilter: track whether a filter has been initialized
Refuse to link uninitialized filters or initialize a filter twice.
2023-02-12 10:17:26 +01:00
Anton Khirnov
80cf509e73 lavfi/avfilter: export process_options()
Also, replace an AVFilterContext argument with a logging context+private
class, as those are the only things needed in this function.

Will be useful in future commits.
2023-02-12 10:16:41 +01:00
Stefano Sabatini
abfe8456a2 lavfi/astats: sort measures keys by name 2023-02-11 17:30:20 +01:00