Commit Graph

11899 Commits

Author SHA1 Message Date
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