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

11021 Commits

Author SHA1 Message Date
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
James Almer
5bad485603 Bump major versions of all libraries
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer
8bc0d31320 avfilter: remove FF_API_PAD_COUNT
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer
863822bfaf avfilter: remove FF_API_BUFFERSINK_ALLOC
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
James Almer
a9e77b42e3 avfilter: remove FF_API_SWS_PARAM_OPTION
Signed-off-by: James Almer <jamrial@gmail.com>
2023-02-09 15:35:14 +01:00
Paul B Mahol
458ae405ef Revert "avfilter/af_pan: fix regression introduced with switch to new channel layout API"
This reverts commit 93a9ee7afd.

Was not fixing real problem, issue is probably outside of pan filter.
2023-02-09 13:40:00 +01:00
Paul B Mahol
7e1d474021 avfilter/af_compand: simplify frame allocation 2023-02-08 18:56:57 +01:00
Paul B Mahol
068ad04908 avfilter/af_compensationdelay: simplify frame allocation 2023-02-08 18:56:56 +01:00
Paul B Mahol
93a9ee7afd avfilter/af_pan: fix regression introduced with switch to new channel layout API
Fixes #10168
2023-02-07 18:28:57 +01:00
Niklas Haas
62dfa54688 avfilter/vf_libplacebo: fix format query
We need to construct the output format list separatedly from the input
format list, because we need to adhere to two extra requirements:

1. Big-endian output formats are always unsupported (runtime error)
2. Combining 'vulkan' with an explicit out_format that is not supported
   by the vulkan frame allocation code is illegal and will crash (abort)

As a free side benefit, this rewrite fixes a possible memory leak in the
`fail` path that was present in the old code.

Signed-off-by: Niklas Haas <git@haasn.dev>
2023-02-07 15:11:49 +01:00
Haihao Xiang
58d6426870 lavfi/vf_vpp_qsv: add support for new scaling modes
The new modes work on new platforms and are avaialable only for oneVPL.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-07 09:51:37 +08:00
Haihao Xiang
36016c5596 lavfi/vf_vpp_qsv: support UYVY in system memory
It only works on Linux

$ ffmpeg -loglevel verbose -init_hw_device qsv=intel -f lavfi -i \
yuvtestsrc -vf "format=uyvy422,vpp_qsv=format=nv12" -f null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-07 09:51:37 +08:00
Haihao Xiang
b92028346c lavfi/deinterlace_qsv: re-use VPPContext for deinterlace_qsv filter
QSVDeintContext and VPPContext have the same base context, and all
features in deinterlace_qsv are implemented in vpp_qsv filter,  so
deinterlace_qsv can be taken as a special case of vpp_qsv filter, and we
may use VPPContext with a different option array, preinit callback and
support pixel formats to implement deinterlace_qsv, then remove
QSVDeintContext.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang
a48c95d3c9 lavfi/deinterlace_qsv: simplify deinterlace_qsv filter
Like what we did for scale_qsv filter, we use QSVVPPContext as a base
context to manage MFX session for deinterlace_qsv filter.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:58 +08:00
Haihao Xiang
077e634965 lavfi/vpp_qsv: add rate option
This is used to control the output at frame rate or field rate when
deinterlace is expected and framerate is not specified.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-02-03 10:27:57 +08:00
Lynne
bbe95f7353
x86: replace explicit REP_RETs with RETs
From x86inc:
> On AMD cpus <=K10, an ordinary ret is slow if it immediately follows either
> a branch or a branch target. So switch to a 2-byte form of ret in that case.
> We can automatically detect "follows a branch", but not a branch target.
> (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)

x86inc can automatically determine whether to use REP_RET rather than
REP in most of these cases, so impact is minimal. Additionally, a few
REP_RETs were used unnecessary, despite the return being nowhere near a
branch.

The only CPUs affected were AMD K10s, made between 2007 and 2011, 16
years ago and 12 years ago, respectively.

In the future, everyone involved with x86inc should consider dropping
REP_RETs altogether.
2023-02-01 04:23:55 +01:00
Niklas Haas
9bfdd8524e avfilter/vf_libplacebo: suppress cast warning
This warning was introduced when ee65039 removed the cast.
2023-01-30 20:34:55 +01:00
Paul B Mahol
5508e04c7b avfilter/vf_colorlevels: add support for gbrpf32 format 2023-01-30 18:42:49 +01:00
Haihao Xiang
2d202985b7 lavfi/vpp_qsv: factor out the code for filter definition
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 09:08:04 +08:00
Haihao Xiang
9c09fb232b lavfi/scale_qsv: re-use VPPContext for scale_qsv filter
QSVScaleContext and VPPContext have the same base context, and all
features in scale_qsv are implemented in vpp_qsv filter,  so scale_qsv
can be taken as a special case of vpp_qsv filter, and we may use
VPPContext with a different option array, preinit callback and supported
pixel formats to implement scale_qsv then remove QSVScaleContext

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Haihao Xiang
d66312cf27 lavfi/scale_qsv: simplify scale_qsv filter
Use QSVVPPContext as a base context of QSVScaleContext, hence we may
re-use functions defined for QSVVPPContext to manage MFX session for
scale_qsv filter.

In addition, system memory has been taken into account in
QSVVVPPContext, we may add support for non-QSV pixel formats in the
future.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Haihao Xiang
aecfec6f80 avfilter: add VA-API variants of the stack filters
Include hstack_vaapi, vstack_vaapi and xstack_vaapi. They may accept
input streams with different sizes.  libva2 (VA-API 1.0+) is required.

Example:
$ ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.h265 -filter_complex
"[0:v][0:v]hstack_vaapi" -c:v h264_vaapi out.h264

$ ffmpeg \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-hwaccel vaapi -hwaccel_output_format vaapi -i input.h264 \
-filter_complex "[0:v][1:v][2:v][3:v]xstack_vaapi=inputs=4:fill=0x000000:layout=0_0_1920x1080|w0_0_1920x1080|0_h0_1920x1080|w0_h0_1920x1080" \
-c:v hevc_vaapi out.h265

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-30 08:48:58 +08:00
Andreas Rheinhardt
35f837710c avfilter/vf_ssim360: Constify AVFilter
This brings ff_vf_ssim360 in line with its declaration in allfilters.c;
this discrepancy is actually undefined behaviour.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:53 +01:00
Andreas Rheinhardt
5fd4d3faf1 avfilter/vf_ssim360: Don't initialize twice
The FILTER_INPUTS and FILTER_OUTPUTS macros already set
AVFilter.(inputs|outputs); Clang therefore emits a warning for
this: "initializer overrides prior initialization of this subobject
[-Winitializer-overrides]"

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:19:24 +01:00
Andreas Rheinhardt
54659e329e avfilter/vf_ssim360: Fix left-shift of negative value
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-01-28 18:18:57 +01:00
Martin Storsjö
c0cf2c4786 lavfi/vf_ssim360: Fix compilation with MSVC
Don't use "static const" for compile time float constants, but use
defines. This fixes the following error:

src/libavfilter/vf_ssim360.c(549): error C2099: initializer is not a constant

Signed-off-by: Martin Storsjö <martin@martin.st>
2023-01-28 18:20:19 +02:00
Shannon Chen
ed519a3690 lavfi: Add vf_ssim360 filter
Customized SSIM for various projections (and stereo formats) of 360 images and videos.

Further contributions by:
Ashok Mathew Kuruvilla
Matthieu Patou
Yu-Hui Wu
Anton Khirnov

Suggested-By: ffmpeg@fb.com
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-01-28 12:00:27 +01:00
Paul B Mahol
ac37b2c2b1 avfilter/f_reverse: set output frame duration 2023-01-27 23:53:26 +01:00
Paul B Mahol
d9b07a9853 avfilter/vf_ciescope: set output frame duration 2023-01-27 23:13:16 +01:00
Paul B Mahol
23d0214939 avfilter/vf_tpad: set output frame duration 2023-01-27 23:01:52 +01:00
Paul B Mahol
7b78684f96 avfilter/vf_random: set output frame duration 2023-01-27 23:01:52 +01:00
Paul B Mahol
a749e43c86 avfilter/vf_datascope: call av_frame_copy_props() 2023-01-27 19:50:10 +01:00
Paul B Mahol
40512dbd96 avfilter/af_adynamicequalizer: add auto option 2023-01-27 15:00:53 +01:00
Ashyni
6869a80e76 avfilter/vf_cropdetect: fix type for old_limit 2023-01-27 14:57:28 +01:00
Paul B Mahol
20b96494de avfilter/vf_scdet: fix introduced discrepancy with latest change 2023-01-24 22:02:45 +01:00
Ashyni
69c060bea2 avfilter/vf_cropdetect: add ability to change limit at runtime
Fixes: https://trac.ffmpeg.org/ticket/9851

Signed-off-by: Ashyni <jeffrey.c@tuta.io>
2023-01-24 21:53:53 +01:00
Paul B Mahol
ab8cde6efa avfilter/vf_dblur: also filter last scanline 2023-01-19 12:33:55 +01:00
Paul B Mahol
31c15a0880 avfilter/vf_dblur: allow radius < 1.0 2023-01-19 12:33:55 +01:00
Paul B Mahol
bf23d530d2 avfilter/vf_histogram: call av_frame_copy_props() 2023-01-17 23:20:00 +01:00
Paul B Mahol
6ce51e5ee1 avfilter/vf_lagfun: call av_frame_copy_props() 2023-01-17 22:55:14 +01:00
Paul B Mahol
3cc08688e3 avfilter/vf_elbg: call av_frame_copy_props() 2023-01-17 22:43:39 +01:00
Paul B Mahol
ceb52d47a3 avfilter/avf_showvolume: set output video frame duration 2023-01-17 19:02:35 +01:00
Paul B Mahol
04bbf5f70d avfilter/vsrc_gradients: set output video frame duration 2023-01-17 18:49:31 +01:00
Paul B Mahol
a13931843e avfilter/avf_abitscope: set output time_base and output frame duration 2023-01-17 18:36:37 +01:00
Paul B Mahol
2c3f211b6d avfilter/af_virtualbass: call av_frame_copy_props() 2023-01-17 18:36:37 +01:00
Paul B Mahol
07485a6975 avfilter/vf_scdet: change threshold checking
Also allow score to match threshold thus allowing ==0.0 scores.
2023-01-17 18:03:14 +01:00
Paul B Mahol
11b02fc675 avfilter/af_arnndn: unbreak filtering 2023-01-17 17:46:58 +01:00
Paul B Mahol
180a7d2d6c avfilter/af_arnndn: call av_frame_copy_props() 2023-01-17 17:46:58 +01:00
Paul B Mahol
697e0fc062 avfilter/af_afftfilt: call av_frame_copy_props() 2023-01-17 17:46:58 +01:00
Paul B Mahol
5625f0542d avfilter/af_afftdn: call av_frame_copy_props() 2023-01-17 17:46:58 +01:00
Paul B Mahol
6d2b57fd31 avfilter/vsrc_cellauto: set video frame duration 2023-01-17 17:46:58 +01:00
Paul B Mahol
e845c3e00a avfilter/vsrc_life: set video frame duration 2023-01-17 17:46:58 +01:00
Paul B Mahol
45910b2504 avfilter/vsrc_mandelbrot: set video frame duration 2023-01-17 17:46:58 +01:00
Paul B Mahol
96d4f74548 avfilter/vsrc_mptestsrc: set video frame duration 2023-01-17 17:46:58 +01:00
Paul B Mahol
218278b11d avfilter/vsrc_testsrc: set video frame duration 2023-01-17 17:46:57 +01:00
Paul B Mahol
aa24719843 avfilter/vsrc_sierpinski: set video frame duration 2023-01-17 17:46:57 +01:00
Paul B Mahol
d590fbf306 avfilter/vf_ciescope: fix black-point position 2023-01-17 17:46:57 +01:00
Paul B Mahol
e6b9191e92 avfilter/vf_ciescope: switch to anti-aliased lines 2023-01-17 17:46:57 +01:00
Paul B Mahol
6b8adbfe03 avfilter/avf_a3dscope,avf_showcwt: set video frame duration 2023-01-17 14:50:08 +01:00
Paul B Mahol
2cee62295f avfilter/af_dialoguenhance: call av_frame_copy_props() 2023-01-17 14:50:08 +01:00
Paul B Mahol
8885d5dc7a avfilter/af_surround: call av_frame_copy_props() 2023-01-17 14:50:08 +01:00
Paul B Mahol
6a205d244a avfilter/af_afir: call av_frame_copy_props() 2023-01-17 14:50:08 +01:00
Haihao Xiang
faf0afb5d9 lavfi/overlay_vaapi: remove unnecessary code
VA-API filter is not required.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
f1a8d3b0b6 lavfi/vaapi: remove duplicated code
Add a ff_ function to handle mulitple pipeline parameters. No functional
changes.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
7491545320 lavfi/qsv: use QSVVPPContext as base context in vf_vpp_qsv/vf_overlay_qsv
The same members between QSVVPPContext and VPPContext are removed from
VPPContext, and async_depth is moved from QSVVPPParam to QSVVPPContext
so that all QSV filters using QSVVPPContext may support async depth.

In addition, we may use QSVVPPContext as base context in other QSV
filters in the future so that we may re-use functions defined in
qsvvpp.c for other QSV filters.

This commit shouldn't change the functionality of vpp_qsv / overlay_qsv.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
3763635ef4 lavfi/qsvvpp: set output frame durations
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
6ce23ebaac lavfi/vf_vpp_qsv: check output format string against NULL pointer
This is in preparation for reusing the code for other QSV filters. E.g.
deinterlacing_qsv may have an option array without format option

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
dc5369144b lavfi/vf_vpp_qsv: add has_passthrough flag in VPPContext
QSV filters may set this flag in preinit callback to turn on / off pass
through mode

This is in preparation for reusing the code for other QSV filters. E.g.
scale_qsv filter doesn't support pass through mode.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
a1b3e8f2d7 lavfi/vf_vpp_qsv: add vpp_preinit callback
Set the expected default value for options in this callback, hence we
have the right values even if these options are not included in the
option arrray.

This is in preparation for reusing the code for other QSV filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
eb71c67dcc lavfi/vf_vpp_qsv: allow special values for the output video dimensions
Special values are:
0 = original width/height
-1 = keep original aspect

This is in preparation for reusing the code for other QSV filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
129530e917 lavfi/vf_vpp_qsv: handle NULL pointer when evaluating an expression
This patch provides default value if the expression is NULL.

This is in preparation for reusing the code for other QSV filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Haihao Xiang
24a8e1e126 lavfi/vf_vpp_qsv: add "a", "dar" and "sar" variables
Also fix the naming style in enum var_name.

This is in preparation for reusing the code for other QSV filters.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-01-17 10:10:52 +08:00
Paul B Mahol
ac7d21284b avfilter: add fractional delay IR source filter 2023-01-16 09:59:31 +01:00
James Almer
2378cbe36b avfilter/vf_showinfo: add support for Ambient Viewing Environment side data
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-15 12:32:21 -03:00
James Almer
b37795688a avfilter/vf_showinfo: use av_frame_side_data_name() to print side data names
This ensures all defined types are supported, even if only to report
their presence and print their size if a custom implementation is
not added.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-01-13 18:30:51 -03:00
Anton Khirnov
54c0e72b42 lavfi/graphparser: drop a redundant label 2023-01-10 11:52:02 +01:00
Anton Khirnov
ca67a783ab lavfi/graphparser: improve applying graph-level sws options
The current code will apply them if the options string does not contain
a 'flags' substring, and will do so by appending the graph-level option
string to the filter option string (with the standard ':' separator).
This is flawed in at least the following ways:
- naive substring matching without actually parsing the options string
  may lead to false positives (e.g. flags are specified by shorthand)
  and false negatives (e.g. the 'flags' substring is not actually the
  option name)
- graph-level sws options are not limited to flags, but may set
  arbitrary sws options

This commit simply applies the graph-level options with
av_set_options_string() and lets them be overridden as desired by the
user-specified filter options (if any). This is also shorter and avoids
extra string handling.
2023-01-10 11:52:02 +01:00
Anton Khirnov
1c18530e93 lavfi/avfilter: process options for filters without a private class
It still makes sense to apply AVFilterContext-level options to such
filters.
2023-01-10 11:52:02 +01:00
Anton Khirnov
d234b4b193 lavfi/avfilter: simplify process_options()
This function currently treats AVFilterContext options and
filter-private options differently: the former are immediately applied,
while the latter are stored in a dictionary to be applied later.

There is no good reason for having two branches - storing all options in
the dictionary is simpler and achieves the same effect (since it is
later applied with av_opt_set_dict()).

This will also be useful in future commits.
2023-01-10 11:52:02 +01:00
Anton Khirnov
b6ba764552 lavfi/avfilter: export a multikey dict from process_options()
This way the function does not need to be able to match keys to
AVOptions, which will be useful in future commits.
2023-01-10 11:52:02 +01:00
Anton Khirnov
bd7c07c26a lavfi/avfilter: avoid a redundant av_opt_set_dict2() call
Current code first sets AVFilterContext-level options, then aplies the
leftover on the filter's private data. This is unnecessary, applying the
options to AVFilterContext with the AV_OPT_SEARCH_CHILDREN flag
accomplishes the same effect.
2023-01-10 11:52:02 +01:00
Anton Khirnov
a7b1b4bc23 lavfi: remove AVFilter.init_dict()
Nothing uses it anymore.

All options on all filters can now be set with normal AVOptions
mechanisms, such as av_opt_set*().
2023-01-10 11:52:02 +01:00
Anton Khirnov
018a8b9dc3 lavfi/vf_scale: allow passing options to swscale directly
Avoid using the dictionary mechanism, which is non-introspectable. As
this is the only user of AVFilter.init_dict(), this callback can now be
removed.
2023-01-10 11:52:02 +01:00
Paul B Mahol
5d3f0226ad avfilter/avf_avectorscope: add anti-aliased line drawing mode 2023-01-09 18:07:05 +01:00
Clément Bœsch
6e05622216 avfilter/paletteuse: use explicit key indexes in set_frame_lut 2023-01-03 17:29:13 +01:00
Clément Bœsch
68275043a0 avfilter/paletteuse: add atkinson dithering
Atkinson according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

        *   1   1    / 8
    1   1   1
        1
2023-01-03 17:29:13 +01:00
Clément Bœsch
c973e8ae79 avfilter/paletteuse: add burkes dithering
Burkes according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

          *  8  4
    2  4  8  4  2   / 32
2023-01-03 17:29:13 +01:00
Clément Bœsch
9973343bf9 avfilter/paletteuse: add sierra3 dithering
Sierra3 according to
https://bisqwit.iki.fi/jutut/kuvat/ordered_dither/error_diffusion.txt:

          *  5  3
    2  4  5  4  2
       2  3  2      / 32
2023-01-03 17:29:13 +01:00
Clément Bœsch
11926c4bd4 avfilter/palette{gen,use}: misc for-loop cosmetics 2023-01-03 17:18:56 +01:00
Clément Bœsch
1340fe7caf avfilter/paletteuse: move r,g,b computation in a more local scope 2023-01-03 17:18:55 +01:00
Clément Bœsch
1ae1b707e2 avfilter/paletteuse: remove mean error tool
This belongs in another filter.
2023-01-03 17:18:55 +01:00
Clément Bœsch
8789a9e05b avfilter/paletteuse: remove alternative search methods
This is a maintenance pain more than anything. It appears to make the
code slightly faster as a side effect.
2023-01-03 17:18:55 +01:00
Clément Bœsch
0f7942afa6 avfilter/paletteuse: switch to recursive method
It appears faster than the iterative method on my machine (1.06x
faster), so I'm guessing compilers improved over time (the iterative
version was slightly faster in the past).
2023-01-03 17:18:55 +01:00
Clément Bœsch
6c7b54e962 avfilter/paletteuse: use lowbias32 for color hashing
Impact is more negligible than previous commit but still faster (1.02x).
2023-01-03 17:18:55 +01:00
Clément Bœsch
c9084cd0e2 avfilter/palettegen: use lowbias32 for color hashing
1.12x faster overall in palettegen on my machine.
2023-01-03 17:18:55 +01:00
Clément Bœsch
3cafbdc083 avfilter/palette: add lowbias32 hashing 2023-01-03 17:18:55 +01:00
Clément Bœsch
051926868c avfilter/palette{gen,use}: update Copyright after recent changes 2023-01-03 17:18:55 +01:00
Clément Bœsch
3a4a6c7815 avfilter/palettegen: use libc qsort
Now that the sort function is deterministic, we can rely on the libc
sorting function.
2023-01-03 17:18:55 +01:00
Clément Bœsch
8057e1a618 avfilter/palettegen: make refs order deterministic
Currently, in case of equality on the first color channel, the order of
the ref colors is defined by the hashing function. This commit makes the
sorting deterministic and improve the hierarchical ordering.
2023-01-03 17:18:55 +01:00
Clément Bœsch
2441e53c0a avfilter/palettegen: add a warning about supporting only sRGB 2023-01-03 17:18:55 +01:00
Clément Bœsch
9026d92c13 avfilter/palettegen: base box split decision on a perceptual model
Similar to the change in paletteuse, we rely on a perceptual model to
decide how and where to split the box.
2023-01-03 17:18:55 +01:00
Clément Bœsch
724f52b906 avfilter/palettegen: switch to signed arithmetic
This prevents mixed sign arithmetic (typically because we have signed
color channel differences), which has nasty side effects in C.
2023-01-03 17:18:55 +01:00
Clément Bœsch
67ce6ad9a2 avfilter/palettegen: rename local variable box_weight to weight
This variable is used only for the running weight (used to reach the
target median). The places where we actually need the box weight are
changed to use box->weight.
2023-01-03 17:18:55 +01:00
Clément Bœsch
61d334d8c3 avfilter/palettegen: misc cosmetics 2023-01-03 17:18:55 +01:00
Clément Bœsch
efb0a6f6ce avfilter/palettegen: compute average color within compute_box_stats() 2023-01-03 17:18:55 +01:00
Clément Bœsch
dafd43b78d avfilter/palettegen: change cut score from ∑e² to max e²
This is following the results from personal research¹.

¹: https://github.com/ubitux/research/tree/main/color-quantization#results
2023-01-03 17:18:55 +01:00
Clément Bœsch
187f5e7f90 avfilter/palettegen: rename variance to cut_score
"Variance" wasn't exactly the correct word; "cut score" is more
agnostic, which will be useful when changing the algorithm in the next
commit.
2023-01-03 17:18:55 +01:00
Clément Bœsch
e49fc1a6ef avfilter/palettegen: always compute the box variance
The variance computation is simple enough now (since we can use the axis
squared errors) that it doesn't need to have a complex lazy computation
logic.
2023-01-03 17:18:55 +01:00
Clément Bœsch
9e5f494d26 avfilter/palettegen: use box->major_axis without intermediate variable 2023-01-03 17:18:55 +01:00
Clément Bœsch
86bced7c65 avfilter/palettegen: define the best axis to cut using the squared error
This is following the results from personal research¹.

¹: https://github.com/ubitux/research/tree/main/color-quantization#results
2023-01-03 17:18:55 +01:00
Clément Bœsch
21f7814238 avfilter/palettegen: move box stats computation to a dedicated function 2023-01-03 17:18:55 +01:00
Clément Bœsch
a0587c0219 avfilter/paletteuse: switch to a perceptual model
Now the selection of the color is based on a distance built around human
perception of color instead of the unreliable sRGB triplet one.
2023-01-03 17:18:55 +01:00
Clément Bœsch
1159c36d6d avfilter/paletteuse: remove redundant alpha condition
This is redundant with a != 0xff below.
2023-01-03 17:18:55 +01:00
Clément Bœsch
4c061bc837 avfilter/paletteuse: remove unused alpha split dimension
The equalities in the w{r,g,b} range checks make sure longest is never
0. Even if the alpha ended up being selected in get_next_color() it
would cause underread memory accesses in its caller (colormap_insert).
2023-01-03 17:18:55 +01:00
Clément Bœsch
71ed92e9c4 avfilter/paletteuse: name target color arg consistently in colormap functions 2023-01-03 17:18:55 +01:00
Clément Bœsch
755c427f7a avfilter/paletteuse: switch from u8[4] to u32 for color code
This change simplifies the code quite a bit and make it consistent with
how it's done in palettegen.
2023-01-03 17:18:55 +01:00
Clément Bœsch
31c5f26a46 avfilter/palette{gen,use}: add palette utils
These color management helpers will be shared by palettegen and
paletteuse in the following commits.

Note that it probably makes sense to share at least the sRGB/linear
functions with other filters at some point.

More information on OkLab can be found here: https://bottosson.github.io/posts/oklab/

For the arithmetic integer version, see:
http://blog.pkh.me/p/38-porting-oklab-colorspace-to-integer-arithmetic.html
and https://github.com/ubitux/oklab-int
2023-01-03 17:18:55 +01:00
Clément Bœsch
7bc054e63c avfilter/palette{gen,use}: simplify a few alpha masks 2023-01-03 17:18:55 +01:00
Clément Bœsch
320fbf5f24 avfilter/palette{gen,use}: revert support palettes with alpha
This reverts commit dea673d0d5.

This change cannot work for several reasons, the most obvious ones are:

- the alpha is being part of the scoring of the color difference, even
  though we can not interpret the alpha as part of the perception of the
  color (we don't even know if it's premultiplied or postmultiplied)
- the colors are averaged with their alpha value which simply cannot
  work

The command proposed in the original thread of the patch actually
produces a completely broken file:

    ffmpeg -y -loglevel verbose -i fate-suite/apng/o_sample.png -filter_complex "split[split1][split2];[split1]palettegen=max_colors=254:use_alpha=1[pal1];[split2][pal1]paletteuse=use_alpha=1" -frames:v 1 out.png

We can see that many color pixels are off, but more importantly some
colors have a random alpha value: https://imgur.com/eFQ2UK7

I don't see any easy fix for this unfortunately, the approach appears to
be flawed by design.
2023-01-03 17:18:55 +01:00
Clément Bœsch
cad9d7fc85 avfilter/palettegen: allow a minimum of 2 colors 2023-01-03 17:18:55 +01:00
Paul B Mahol
c94988a781 avfilter/af_afade: add options to control unity/silence gains 2023-01-03 10:25:06 +01:00
Paul B Mahol
3879555cd5 avfilter/afir_template: make IR transitions artifacts free 2023-01-02 15:33:57 +01:00
Paul B Mahol
eeb280f351 avfilter/af_afir: fix prev_selir variable change in private filter context 2022-12-25 20:39:54 +01:00
Paul B Mahol
eaba6bfc51 avfilter/afir_template: reduce memset overhead a little 2022-12-25 20:39:54 +01:00
Paul B Mahol
8906145cdf avfilter/af_afir: increase max partition size 2022-12-25 20:39:54 +01:00
Paul B Mahol
64ddf04460 avfilter/af_afir: reduce memory usage 2022-12-25 20:39:54 +01:00
Paul B Mahol
9498bc7c32 avfilter/af_afir: make dry/wet runtime options 2022-12-22 17:09:15 +01:00
Paul B Mahol
54ebe1e8dc avfilter/afir_template: skip useless moving of samples 2022-12-22 17:09:15 +01:00
Paul B Mahol
bc1fc1be99 avfilter/afir_template: stop using hack to zero out data 2022-12-22 17:09:15 +01:00
Niklas Haas
a69b08790b avfilter/vf_tinterlace: support full-range YUV
This filter, when used in the "pad" mode, currently makes the
distinction between limited and full range solely by testing for YUVJ
pixel formats at link setup time. This is deprecated and should be
improved to perform the detection based on the per-frame metadata.

In order to make this distinction based on color range metadata, which
is only known at the time of filtering frames, for simplicity, we simply
allocate two copies of the "black" frame - one for limited range and the
other for full range metadata. This could be done more dynamically (e.g.
as-needed or simply by blitting the appropriate pixel value directly),
but this change is relatively simple and preserves the structure of the
existing code.

This commit actually fixes a bug in FATE - the new output is correct for
the first time. The previous md5 ref was of a frame that incorrectly
combined full-range pixel data with limited-range black fields. The
corresponding result has been updated.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-12-20 14:02:37 +01:00
Niklas Haas
8e2f61ef04 avfilter/vf_blackdetect: support full-range YUV
This filter currently makes the distinction between limited and full
range by testing for the deprecated YUVJ pixel formats at link setup
time. This is deprecated and should be improved to perform the detection
based on the per-frame metadata.

Rewrite it to calculate the black pixel threshold at the time of
filtering a frame, when metadata about the frame's color range is known.
Doing it this way has the small side benefit of being able to handle
streams with variable metadata, and is not a meaningful performance
cost.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-12-20 14:02:37 +01:00
Paul B Mahol
3b66757d7d avfilter: add adrc filter 2022-12-19 20:43:58 +01:00
Paul B Mahol
744100af62 avfilter/af_headphone: properly initialize scale 2022-12-19 18:45:56 +01:00
mail@nodoa.me
38b837e0e1 avfilter/vf_decimate: add mixed option to process input only partially to be decimated
Enabling the option will only decimate frames below dupthresh and output at
variable frame rate.
2022-12-19 16:24:25 +01:00
Paul B Mahol
a350e68c83 avfilter/af_afir: fix some misc low priority issues
Remove double ;; and dead store.
2022-12-18 23:53:19 +01:00
Paul B Mahol
8c75e5fdd3 avfilter/af_afir: improve output when IR switching at runtime
Also improve normalization and add more gtype modes
2022-12-18 19:58:12 +01:00
Saliev, Rafik F
8ad988ac37 libavfilter/dnn: fix openvino async mode
Bugfix: The OpenVino DNN backend in the 'async' mode sets
'task->inference_done' to 'complete' prior to data copy from
OpenVino output buffer to task's output frame.
This order causes task destroy in ff_dnn_get_result_common()
prior to model output processing.

Signed-off-by: Rafik Saliev <rafik.f.saliev@intel.com>
2022-12-17 09:55:14 +08:00
Paul B Mahol
69ac78da9b avfilter/afir_template: avoid indirect accessing nb_partitions value 2022-12-12 20:29:07 +01:00
Paul B Mahol
a73f4ca49b avfilter/afir_template: skip wet gain if its 1 2022-12-12 20:29:07 +01:00
Paul B Mahol
91abbb9d02 avfilter/af_afir: reduce output gain with default parameters
It was unreasonably high. Also change scaling to reduce
rare quantization errors.
2022-12-12 20:29:07 +01:00
Paul B Mahol
8556006984 avfilter/af_afir: improve output quality with small minp
Remove direct convolution implementation as its give worse
results. Simplifies code too.
2022-12-11 18:33:24 +01:00
Paul B Mahol
442bbdb3c5 avfilter/drawutils: rgb48/bgr48 is supported 2022-12-10 14:57:05 +01:00
Paul B Mahol
f0f19f3d3d avfilter: add corr video filter 2022-12-08 13:03:42 +01:00
Haihao Xiang
4061c22428 lavfi/vf_scale_qsv: remove PI, PHI and E
PI, PHI and E are defined in libavutil/eval.c, and user may use these
constants for scale_qsv filter, so we needn't re-define these variables
in vf_scale_qsv.c

Reviewed-by: Gyan Doshi <ffmpeg@gyani.pro>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:29:23 +08:00
Haihao Xiang
3552dba0e1 lavfi/vf_vpp_qsv: accept P010 input in system memory
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:25:52 +08:00
Haihao Xiang
e5faa1d50c lavfi/vf_vpp_qsv: allow user to set scale_mode with constants
$ ffmpeg -f lavfi -i testsrc -vf "format=nv12,vpp_qsv=scale_mode=hq" -f
null -

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:24:21 +08:00
Haihao Xiang
d51edd225d lavfi/vf_vpp_qsv: use macros for extra mfx parameter
Make it easy to add new extra mfx parameter buffer. No functional
change.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-12-08 14:22:12 +08:00
Wenbin Chen
20f2941191 libavfilter/qsvvpp: Change the alignment to meet the requirement of YUV420P format
When process yuv420 frames, FFmpeg uses same alignment on Y/U/V
planes. VPL and MSDK use Y plane's pitch / 2 as U/V planes's
pitch, which makes U/V planes 16-bytes aligned. We need to set
a separate alignment to meet runtime's behaviour.

Now alignment is changed to 16 so that the linesizes of U/V planes
meet the requirment of VPL/MSDK. Add get_buffer.video callback to
qsv filters to change the default get_buffer behaviour.

Now the commandline works fine:
ffmpeg -f rawvideo -pix_fmt yuv420p -s:v 3082x1884 \
-i ./3082x1884.yuv -vf 'vpp_qsv=w=2466:h=1508' -f rawvideo \
-pix_fmt yuv420p 2466_1508.yuv

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2022-12-08 14:21:07 +08:00
Paul B Mahol
f2e0351b77 avfilter/vf_vif: add missing framesync options 2022-12-07 12:23:16 +01:00
Paul B Mahol
cb9ab38c52 avfilter/vf_chromanr: split inner loops
Makes overall faster processing in default case.
2022-12-07 00:57:25 +01:00
Paul B Mahol
cc11afe502 avfilter/avf_showvolume: make rms meter actually get rms of whole frame 2022-12-06 17:31:56 +01:00
Paul B Mahol
520111c610 avfilter/vf_thumbnail: allow to change stats log level 2022-12-05 21:08:02 +01:00