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

10972 Commits

Author SHA1 Message Date
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
Paul B Mahol
725328672a avfilter/vf_vibrance: reduce copy operations 2023-02-11 10:36:56 +01:00
Paul B Mahol
acd87d41f2 avfilter/vf_exposure: reduce copy operations 2023-02-11 10:36:56 +01:00