1
0
Fork 0
Commit Graph

11515 Commits

Author SHA1 Message Date
Wenbin Chen d52e8ed114 libavfilter/vf_dnn_detect: Use class confidence to filt boxes
Use class confidence instead of box_score to filt boxes, which is more
accurate. Class confidence is obtained by multiplying class probability
distribution and box_score.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Discovered by Zeng Yunxiang

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00
Michael Niedermayer 08bd2cbfeb
avfilter/avf_showwaves: Check history_nb_samples
Fixes: out of array access
Fixes: tickets/10756/poc18ffmpeg

Discovered by Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-30 21:50:04 +01:00
Wenbin Chen 56c5930ec3 libavfilter/vf_dnn_detect: Add two outputs ssd support
For this kind of model, we can directly use its output as final result
just like ssd model. The difference is that it splits output into two
tensors. [x_min, y_min, x_max, y_max, confidence] and [lable_id].

Model example refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/intel/person-detection-0106

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-30 12:12:58 +08:00
Wenbin Chen 86435582a6 libavfilter/dnn_backend_openvino: Add dynamic output support
Add dynamic outputs support. Some models don't have fixed output size.
Its size changes according to result. Now openvino can run these kinds of
models.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-30 12:12:51 +08:00
Michael Niedermayer bb04235d72
avfilter/vf_vidstabdetect: Avoid double AVERRORS
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:36:03 +01:00
Michael Niedermayer 7deaca71b3
avfilter/vf_swaprect: round coordinates down
Fixes: out of array access:
Fixes: tickets/10745/poc12ffmpeg

Found-by: Li Zeyuan and Zeng Yunxiang.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:59 +01:00
Michael Niedermayer 9f4c5bd7d2
avfilter/vf_swaprect: Use height for vertical variables
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:58 +01:00
Michael Niedermayer 9d1ba698d2
avfilter/vf_swaprect: assert that rectangles are within memory
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:58 +01:00
Michael Niedermayer a88b06f9ee
avfilter/af_alimiter: Check nextpos before use
Fixes: out of array read
Fixes: tickets/10744/poc11ffmpeg

Found-by: Li Zeyuan and Zeng Yunxiang.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 21:07:57 +01:00
Michael Niedermayer 61e73851a3
avfilter/f_reverse: Apply PTS compensation only when pts is available
Fixes: out of array access
Fixes: tickets/10753/poc16ffmpeg

Regression since: 45dc668aea
Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:29:07 +01:00
Michael Niedermayer 50f0f8c53c
avfilter/af_stereowiden: Check length
Fixes: out of array access
Fixes: tickets/10746/poc13ffmpeg

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 19:29:06 +01:00
Michael Niedermayer 0ecc1f0e48
avfilter/vf_weave: Fix odd height handling
Fixes: out of array access
Fixes: tickets/10743/poc10ffmpeg

Found-by: Zeng Yunxiang and Li Zeyuan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:28:11 +01:00
Michael Niedermayer c443658d26
avfilter/edge_template: Fix small inputs with gaussian_blur()
Fixes: out of array access
Fixes: Ticket10699
Fixes: poc5ffmpeg

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:28:10 +01:00
Paul B Mahol e6459abfad
avfilter/af_stereotools: round-up max size of buffer
Fixes: out of array access
Fixes: tickets/10747/poc14ffmpeg

Found-by: Zeng Yunxiang and Song Jiaxuan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:06 +01:00
Michael Niedermayer e4d2666bdc
avfilter/vf_gradfun: Do not overread last line
The code works in steps of 2 lines and lacks support for odd height
Implementing odd height support is better but for now this fixes the
out of array access

Fixes: out of array access
Fixes: tickets/10702/poc6ffmpe

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:05 +01:00
Michael Niedermayer ab0fdaedd1
avfilter/avf_showspectrum: fix off by 1 error
Fixes: out of array access
Fixes: tickets/10749/poc15ffmpeg

Regression since: 81df787b53

Found-by: Zeng Yunxiang
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:04 +01:00
Michael Niedermayer aec67d3d7d
avfilter/af_stereowiden: Round length to nearest
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-12-29 01:19:03 +01:00
Zhao Zhili 56ca0f2918 avfilter/vf_showinfo: add udu_sei_as_ascii option
Some encoders (e.g., libx264) dump encoder configuration as user
data unregistered SEI message. This option try to print it as
ascii character when possible.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-12-28 21:22:54 +08:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
Vittorio Giovara 05bfc03752 Add new vf_tiltandshift filter
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2023-12-21 17:16:16 -05:00
Wenbin Chen 9415c2c11f libavfilter/vf_dnn_detect: Add initialized value to function pointer
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-21 16:15:23 +08:00
Wenbin Chen 233c44f735 libavfilter/vf_dnn_detect: Fix a control flow issue
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-21 16:15:23 +08:00
Wenbin Chen 1fa3346c70 libavfilter/vf_dnn_detect: Add yolov4 support
The difference of yolov4 is that sigmoid function needed to be applied
on x, y coordinates. Also make it compatiple with NHWC output as the
yolov4 model from openvino model zoo has NHWC output layout.

Model refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v4-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:51:52 +08:00
Wenbin Chen a882fc0294 libavfilter/vf_dnn_detect: Add yolov3 support
Add yolov3 support. The difference of yolov3 is that it has multiple
outputs in different scale to perform better on both large and small
object.

The model detail refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v3-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:50 +08:00
Wenbin Chen da02836b9d libavfilter/vf_dnn_detect: Add input pad
Add input pad to get model input resolution. Detection models always
have fixed input size. And the output coordinators are based on the
input resolution, so we need to get input size to map coordinators to
our real output frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:37 +08:00
Wenbin Chen 22652b576c libavfiter/dnn_backend_openvino: Add multiple output support
Add multiple output support to openvino backend. You can use '&' to
split different output when you set output name using command line.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-12-16 21:50:16 +08:00
Wenbin Chen 22bebfa5e6 libavfilter/vf_dnn_detect: Set used pointer to NULL
Set used pointer to NULL in case it leaks the storage.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen a1e8892a8a libavfilter/vf_dnn_detect: Fix uninitialized variables error
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen 833722343a libavfilter/vf_dnn_detect: Add NULL pointer check
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Wenbin Chen e01afa1c6d libavfilter/vf_dnn_detect: Fix an incorrect expression
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-12-15 20:04:54 +08:00
Gyan Doshi b9fd3e7a88 avfilter/select: initialize prev_selected_n to NAN
As per the doc, prev_selected_n should be NAN at the start.
However, this was never set.
2023-12-10 09:29:50 +05:30
nilfm 5f4b7bf2b5 avfilter/vf_libvmaf: fix string comparison bug
The libvmaf filter was doing substring checks in place of string equality
comparisons. This led to a bug when the user specified the pooling method
"harmonic_mean", since "mean" was checked first and the substring comparison
returned true. This patch changes all substring comparisons for string equality
comparisons. This is both correct and more efficient than the existing method.

Signed-off-by: nilfm <nilf@netflix.com>
2023-12-08 10:32:46 -08:00
Cosmin Stejerean 737ede405b avfilter/bwdif: account for chroma sub-sampling in min size calculation
The current logic for detecting frames that are too small for the
algorithm does not account for chroma sub-sampling, and so a sample
where the luma plane is large enough, but the chroma planes are not
will not be rejected. In that event, a heap overflow will occur.

This change adjusts the logic to consider the chroma planes and makes
the change to all three bwdif implementations.

Fixes #10688

Signed-off-by: Cosmin Stejerean <cosmin@cosmin.at>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Philip Langdale <philipl@overt.org>
2023-12-07 10:00:12 +08:00
Paul B Mahol ebfd3912e9 avfilter/asrc_flite: use streaming function
Fix continuous accumulation of audio samples for big txt inputs.
2023-12-06 10:52:46 +01:00
Paul B Mahol d793af982e avfilter/asrc_flite: switch to activate
Allows to set EOF timestamp.
2023-12-06 10:52:45 +01:00
Anton Khirnov c6483f1c2a lavfi/buffersink: avoid leaking peeked_frame on uninit 2023-12-06 10:01:09 +01:00
Haihao Xiang 35a555e2b9 lavfi/vf_vpp_qsv: set the default value of async_depth to 4
Both qsv encoders and decoders use 4 as the default value of
async_depth, let's use 4 as the default value for vpp_qsv filter too.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2023-12-05 10:12:16 +08:00
Paul B Mahol 9e74c7ae87 avfilter/af_dialoguenhance: add double-floating point sample format support 2023-12-04 23:14:40 +01:00
Paul B Mahol 704ef556fe avfilter/af_surround: refactor some code 2023-12-04 23:14:39 +01:00
Kyle Swanson 9f1dbca820 avfilter/libvmaf: small cleanup for style, whitespace, unused LIBVMAFContext struct members
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-12-04 10:00:01 -08:00
Paul B Mahol d9e41ead82 avfilter/avfilter: fix OOM case for default activate
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-12-03 23:26:43 +01:00
Paul B Mahol e3e3531d1e avfilter/vsrc_gradients: make rotation always continuous if speed changes 2023-12-03 18:43:26 +01:00
Paul B Mahol 8888574d10 avfilter/vsrc_gradients: add commands support 2023-12-03 18:30:06 +01:00
Paul B Mahol f84412d6f4 avfilter/vf_corr: for all zero returns zero score instead of 1 2023-12-03 03:10:05 +01:00
Paul B Mahol aad3223978 avfilter/vf_corr: add slice threading support 2023-12-03 03:10:03 +01:00
Paul B Mahol db7b838237 avfilter/vf_chromanr: compare correct variables for advanced mode 2023-12-01 21:31:38 +01:00
Paul B Mahol a30adf9f96 avfilter/framesync: fix OOM case
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-11-30 11:08:34 +01:00
Paul B Mahol 47e214245b avfilter/arls_template: use defines for all constants 2023-11-28 16:09:12 +01:00
Paul B Mahol f66536cc58 avfilter: add Affine Projection adaptive audio filter 2023-11-28 15:40:34 +01:00
Paul B Mahol 67ce690bc6 avfilter/af_anlms: set output frame duration 2023-11-28 13:17:19 +01:00
Paul B Mahol 411c516453 avfilter/af_arls: set output frame duration 2023-11-28 13:17:13 +01:00
Paul B Mahol bafbb0697e avfilter/af_amix: set output frame duration 2023-11-28 13:17:13 +01:00
Paul B Mahol 358aced447 avfilter/af_amultiply: set output frame duration 2023-11-28 13:17:12 +01:00
Paul B Mahol 8b9c400f1d avfilter/af_amerge: use already provided outlink 2023-11-28 13:17:12 +01:00
Paul B Mahol c979ccdfd7 avfilter: no need to request more samples if internal frame is available 2023-11-28 13:16:18 +01:00
Paul B Mahol 3bca828d39 avfilter/af_arls: add double sample format support 2023-11-27 20:27:27 +01:00
Paul B Mahol 42e45ea8ff avfilter/af_anlms: add double sample format support 2023-11-27 20:27:25 +01:00
Paul B Mahol 5f87a68cf7 avfilter/vf_colorcorrect: fix memory leaks 2023-11-27 12:10:26 +01:00
Paul B Mahol f1f973313b avfilter/af_dialoguenhance: do output scaling once 2023-11-27 11:56:27 +01:00
Paul B Mahol b1942734c7 avfilter/af_afwtdn: fix crash with EOF handling 2023-11-27 11:56:26 +01:00
Paul B Mahol 4671fb7dfb avfilter/af_dialoguenhance: simplify channels copy 2023-11-27 11:56:23 +01:00
Wenbin Chen 47b2328076 libavfilter/vf_dnn_detect: Add yolo support
Add yolo support. Yolo model doesn't output final result. It outputs
candidate boxes, so we need post-process to remove overlap boxes to
get final results. Also, the box's coordinators relate to cell and
anchors, so we need these information to calculate boxes as well.

Model detail please refer to: https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/yolo-v2-tf

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-11-26 20:38:36 +08:00
Wenbin Chen caa5d123a7 libavfilter/vf_dnn_detect: Add model_type option.
There are many kinds of detection DNN model and they have different
preprocess and postprocess methods. To support more models,
"model_type" option is added to help to choose preprocess and
postprocess function.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
2023-11-26 20:15:55 +08:00
Paul B Mahol e7111ba44a avfilter/vsrc_gradients: allow zero speed 2023-11-26 02:07:45 +01:00
Paul B Mahol f1acb0d843 avfilter/vsrc_gradients: add square type 2023-11-26 02:07:44 +01:00
Paul B Mahol 2d9ed64859 avfilter/af_dialoguenhance: fix overreads 2023-11-25 13:05:31 +01:00
Paul B Mahol 37c5bcc4e8 avfilter/af_channelmap: do not override set channel layout 2023-11-25 13:05:31 +01:00
Paul B Mahol 4adb93dff0 avfilter/asrc_afirsrc: fix by one smaller allocation of buffer 2023-11-23 15:01:55 +01:00
James Almer 0008e1c5d5 avfilter/asrc_anullsrc: fix allowed range for sample_rate
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2023-11-22 19:41:15 -03:00
Paul B Mahol 4af412be71 avfilter: use AV_OPT_TYPE_CHLAYOUT 2023-11-22 19:28:40 +01:00
Paul B Mahol d55d0bba48 avfilter/af_afir: remove flag that is not needed 2023-11-19 23:59:23 +01:00
Paul B Mahol 28a43cf7fe avfilter/af_afir: no need to dynamically add outpad 2023-11-19 23:55:54 +01:00
Paul B Mahol 6579d95df3 avfilter/af_afir: refactor crossfade code 2023-11-19 23:47:52 +01:00
Paul B Mahol bbdd604b9e avfilter/af_afir: add timeline support 2023-11-19 23:47:51 +01:00
Paul B Mahol a9205620b1 avfilter/af_afir: remove IR response video rendering support
And deprecate related options.
The same functionality can be done with specialized audio visualization filters.
2023-11-19 13:41:13 +01:00
Paul B Mahol 7c16bf0829 avfilter/avf_showvolume: improve step for vertical orientation 2023-11-18 23:50:39 +01:00
Paul B Mahol 3ed2225a9d avfilter/avf_showvolume: draw channel names directly into output frame 2023-11-18 23:50:38 +01:00
Jun Zhao 2d4aef8982 lavfi/Makefile: fix vf_cropdetect missed edge_common
vf_cropdetect depends on edge_common, it's missing in Makefile.

Fix trac issue:
http://trac.ffmpeg.org/ticket/10664

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-18 20:19:39 +01:00
Diederik de Haas via ffmpeg-devel c07ed10b0e apply spelling fixes
Fix spelling issue as reported by Debian's lintian tool:
accomodate -> accommodate
addtional -> additional
auxillary -> auxiliary
bellow -> below
betweeen -> between
Calulate -> Calculate
coefficents -> coefficients
Defalt -> Default
defaul -> default
higer -> higher
neccesary -> necessary
orignal -> original
ouput -> output
precison -> precision
processsing -> processing
substract -> subtract
Transfered -> Transferred
upto -> up to

Also add several of them to the 'common typos' check in patcheck.

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
2023-11-18 19:55:42 +01:00
Paul B Mahol 5452cbdc15 avfilter/af_afir: add irnorm and irlink options
Deprecate gtype option.
2023-11-18 17:04:53 +01:00
Paul B Mahol 08e97dae20 avfilter/af_adynamicequalizer: add adaptive detection mode 2023-11-17 00:17:54 +01:00
Paul B Mahol 82be1e5c0d avfilter/af_adynamicequalizer: do gain calculations in log domain 2023-11-17 00:17:54 +01:00
sunyuechi afb967b81e af_afir: RISC-V V fcmul_add
Segmented loads are slow, so here we use unit-strided load and narrowing shifts.

c910:
fcmul_add_c: 2179
fcmul_add_rvv_f64: 1652

c908:
fcmul_add_c: 4891.2
fcmul_add_rvv_f64: 2399.5

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2023-11-16 20:53:18 +02:00
Paul B Mahol 7282137f48 lavfi/af_amix: make sure the output does not depend on input ordering
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-14 18:18:26 +01:00
Paul B Mahol 84e400ae37 avfilter/buffersrc: switch to activate
Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.
2023-11-12 23:48:10 +01:00
Paul B Mahol 3ff811a41f avfilter/vf_colortemperature: add gbr(a)pf support 2023-11-12 02:39:44 +01:00
Paul B Mahol 553b31da68 avfilter/avf_showcwt: fix invalid write for full bargraph 2023-11-11 23:29:45 +01:00
Paul B Mahol fa4c2884dd avfilter/avf_showcwt: do not return initial black frames with negative timestamps 2023-11-11 17:53:26 +01:00
Wenbin Chen fa81de4af0 libavfilter/dnn/openvino: Reduce redundant memory allocation
We can directly get data ptr from tensor, so that extral memory
allocation can be removed.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-11-11 09:32:31 +08:00
Paul B Mahol 49719d3cb5 avfilter/avf_showcwt: add fm frequency scaler 2023-11-11 01:19:44 +01:00
Niklas Haas cf60046cdc avfilter/vf_scale: tag output color space
When using vf_scale to force a specific output color space, also tag
this on the AVFrame. (Mirroring existing logic for output range)

Move the sanity fix for RGB after the new assignment, to avoid leaking
bogus YUV colorspace metadata for RGB spaces.
2023-11-09 12:53:35 +01:00
Niklas Haas 5d5bb77af1 avfilter/vf_scale: simplify color matrix parsing logic
No need to write a custom string parser when we can just use an integer
option with preset values. The various bits of fallback logic are wholly
redundant with equivalent logic already inside sws_getCoefficients.

Note: I disallowed setting 'out_color_matrix=auto', because this does
not do anything meaningful in the current code (just hard-codes
AVCOL_SPC_BT470BG fallback).
2023-11-09 12:53:35 +01:00
Niklas Haas ea9557043e avfilter/vf_alphamerge: warn if input not full range
Alpha planes must always be full range, so complain loudly if fed
limited range grayscale input.
2023-11-09 12:53:35 +01:00
Niklas Haas b7284f2410 avfilter/vf_extractplanes: tag alpha plane as full range
Alpha planes are explicitly full range, even for limited range YUVA
formats. Mark them as such.
2023-11-09 12:53:35 +01:00
Marvin Scholz 6667741029 avfilter/vf_tpad: fix check for drawing initialization
The check if drawing needs to be initialized and supported formats
should be drawable ones was flawed, as pad_stop/pad_start is only
populated from stop_duration/start_duration after these checks.

To fix that, check the _duration variants as well and for better
readability and maintainability break the check out into its own
helper.

Fixes a regression from 86b252ea9d
Fix #10621

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-11-09 11:11:00 +01:00
Lynne 99fcdee5e8
nlmeans_vulkan: fix offsets calculation and various stride issues
We calculated offsets as pairs, but addressed them in the shader
as single float values, while reading them as ivec2s.

Also removes unused code (was provisionally added if cooperative matrices
could be used, but that turned out to be impossible).
2023-11-09 09:14:18 +01:00
Paul B Mahol 44a0148fad avfilter/af_adynamicequalizer: do detection of threshold first
Makes better results in final output if multiple filters are cascaded at once.
2023-11-05 16:00:29 +01:00
Paul B Mahol 799fad1828 avfilter/af_adynamicequalizer: always start filtering from unit gain 2023-11-05 16:00:28 +01:00
Paul B Mahol fd1712b6fb avfilter/af_adynamicequalizer: merge direction option with mode option
More user-friendly and self-explanatory what certain mode does.
2023-11-04 15:39:24 +01:00
Paul B Mahol 43226efc21 avfilter/af_adynamicequalizer: add new structure to hold filtering state 2023-11-04 15:39:23 +01:00
Andreas Rheinhardt de4846dd18 avfilter/deshake: Merge header into its only user
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 2fdaeec41b avfilter/vf_deshake: Remove unnecessary emms_c
Redundant since ea043cc53e
(which made 16x16 no longer use MMX).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 392ab35db1 avfilter/vf_mpdecimate: Remove emms_c
Unnecessary now that the pixelutils API abides by the ABI.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:26:25 +01:00
Andreas Rheinhardt 8661b5e8f9 avfilter/vf_format: Deduplicate inputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt c32c1a18b9 avfilter/vsrc_testsrc: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 748c168f8e avfilter/vf_xmedian: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 93abb9b560 avfilter/vf_hsvkey: Deduplicate inputs and outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 50d3c5bd8c avfilter/vf_convolve: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt e557d89ac1 avfilter/vf_chromakey: Deduplicate inputs and outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 2e2c28119f avfilter/vf_blend: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt 1d33a310df avfilter/vf_aspect: Deduplicate inputs
Also avoid using the avfilter-prefix for static objects.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt a40f833bac avfilter/f_graphmonitor: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Andreas Rheinhardt a02670ded7 avfilter/f_drawgraph: Deduplicate outputs
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-11-04 01:24:09 +01:00
Michael Niedermayer c0a18e884c
avfilter/buffersink: fix order of operation with = and <0
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:17:18 +01:00
Michael Niedermayer 9450a4a7fe
avfilter/framesync: fix order of operation with = and <0
Reviewed-by: Sean McGovern <gseanmcg@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-11-03 22:16:33 +01:00
Lynne 0e8abf2698
bwdif_vulkan: fix artifacts on vulkan decode images
Due to making the decode frames context use the coded size, the
filter started to display those artifacts as it reused the input frame's size.

Change it to instead output the real image size for images, not the input.
2023-10-31 21:35:28 +01:00
Niklas Haas d312a33ed2 avfilter/drawutils: remove redundant xyz format check
The code above this does a whitelist on desc->flags, which now includes
the (disallowed) AV_PIX_FMT_FLAG_XYZ for XYZ formats. So there is no
more need for a separate check, here.
2023-10-31 15:46:38 +01:00
Niklas Haas 96dfc4481b avfilter/drawutils: ban XYZ formats
These are not supported by the drawing functions at all, and were
incorrectly advertised as supported in the past.

Note: This check is added only to separate the logic change from the API
change in the following commit, and will be removed again after it
becomes redundant.
2023-10-31 15:43:30 +01:00
Paul B Mahol 6323ca5902 avfilter/vf_feedback: add timeline support 2023-10-30 16:06:46 +01:00
Michael Niedermayer 47e784f881
Bump versions after 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 16:19:14 +01:00
Michael Niedermayer 9d3a7d30c4
Bump versions prior to 6.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-10-29 15:34:05 +01:00
Kyle Swanson e5f774268a avfilter/libvmaf: fix broken cuda build
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-10-27 15:00:58 -07:00
Gyan Doshi 2b300eb533 avfilter/vidstab: add option for file format specification
The vidstab library added support in Nov 2020 for writing/reading
the transforms data in binary in addition to ASCII. The library default
was changed to binary format but no changes were made to the AVfilters
resulting in data file for writing or reading being always opened as text.
This effectively broke the filters.

Option added to vidstabdetect to specify file format and open files in
both filters with the correct attributes.
2023-10-26 15:46:18 +05:30
Martin Storsjö 93cda5a9c2 aarch64: Lowercase UXTW/SXTW and similar flags
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:23 +03:00
Martin Storsjö 184103b310 aarch64: Consistently use lowercase for vector element specifiers
Signed-off-by: Martin Storsjö <martin@martin.st>
2023-10-21 23:25:18 +03:00
Niklas Haas 2d1aeba8f2 avfilter/vf_scale: fix interlaced chroma for other formats
This logic only covers the case of yuv420p. Extend this logic to cover
*all* vertically subsampled YUV formats, which require the same
interlaced scaling logic.

Fortunately, we can get away with re-using the same code for both JPEG
and MPEG range YUV, because the only difference here is the horizontal
alignment. (Which I omit touching for now, to avoid introducing possibly
unintended changes in default behavior)
2023-10-20 15:20:09 +02:00
Niklas Haas 90d327d607 avfilter/vf_showinfo: also print chroma loc
Curiously absent.
2023-10-14 00:16:57 +02:00
Kyle Swanson 2e33f5ced0 avfilter/libvmaf: update pix_fmts
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-10-12 10:37:36 -07:00
Lynne f31d0f1141
nlmeans_vulkan: parallelize workgroup invocations 2023-10-11 16:53:06 +02:00
Lynne 658b01b5ee
nlmeans_vulkan: reduce dispatches by parallelizing the planes 2023-10-11 16:53:04 +02:00
Lynne 6bc8ff7d93
nlmeans_vulkan: fix width/height for chroma plane weights calculation 2023-10-11 16:53:00 +02:00
Kyle Swanson 6028728bb8 avfilter/libvmaf: remove deprecated options 2023-10-10 11:00:20 -07:00
Timo Rothenpieler 8b6ee74d50 avfilter/ddagrab: create secondary xor mouse texture 2023-10-09 20:17:50 +02:00
Timo Rothenpieler 0e7ae95cc2 avfilter/ddagrab: actually use provided texture pointer 2023-10-09 20:17:49 +02:00
Andreas Rheinhardt f62c441e7a avfilter/vulkan_filter: Remove unused label
Unused since 81cc0e1345.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-06 12:28:45 +02:00
Lynne 81cc0e1345
hwcontext_vulkan: properly support STORAGE usage for mutliplane images
Fixes multiplane support on Nvidia.

Also, remove the ENCODE usage, even if the driver signals it as supported.
Currently, it's not used, and when it is used, it'll be gated behind
two extension checks.
2023-10-05 23:50:30 +02:00
Anton Khirnov 63bc6430a6 lavfi/yadif: update output frame durations 2023-10-03 16:57:02 +02:00
Andreas Rheinhardt f58038d498 avcodec/avcodec: Avoid codec_desc.h, codec_par.h inclusions
Instead, use forward declarations; and in order not to affect
any user include these headers for them, but not internally.
This has the advantage of removing implicit inclusions of these
headers from almost all files providing codecs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-10-03 01:59:07 +02:00
Niklas Haas 443471356f avfilter/vf_iccdetect: use ff_icc_profile_sanitize 2023-10-03 00:28:50 +02:00
Paul B Mahol 41f5b73903 avfilter/f_ebur128: do not print summary log if nothing was processed 2023-09-29 18:40:54 +02:00
Paul B Mahol 7ce2e5f3ea avfilter/vf_pseudocolor: add support for more planar alpha formats 2023-09-28 23:09:31 +02:00
Paul B Mahol 0aa75a85e6 avfilter/vf_zscale: fix adding >8 bit alpha plane 2023-09-28 22:46:56 +02:00
Paul B Mahol 086c280901 avfilter/vf_zscale: add more planar formats with alpha 2023-09-28 22:46:55 +02:00
Paul B Mahol 35b6d9d80c avfilter/vf_negate: add support for more planar with alpha 2023-09-28 22:46:54 +02:00
Paul B Mahol 3a5171c9f4 avfilter/vf_extractplanes: add GBRAP14 support 2023-09-28 19:37:58 +02:00
杨亚磊 via ffmpeg-devel ee8d2ece7b lavfi/framequeue: remove redundant logic code
In this logical branch, fq->queued and fq->allocated must be equal.
Deleting this code will make it easier to understand the logic
(copy the data before tail to the newly requested space)

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-09-28 09:25:02 +02:00
Andreas Rheinhardt 97cd698ee4 avfilter/bwdifdsp: Avoid including ff_bwdif_filter_line3_c()
This function is used by the AARCH64 code to filter a few
remaining lines in case the dimensions are not suitably
aligned; it is furthermore also used by checkasm to actually
test the AARCH64 code against. But it is normally not used
and this patch therefore moves it in bwdifdsp.h as a static
inline function so that it can be avoided if possible
or inlined where necessary.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-28 00:17:47 +02:00
Andreas Rheinhardt fa06f48371 avfilter/bwdifdsp: Constify
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-28 00:17:47 +02:00
Andreas Rheinhardt 1db884c625 avfilter/vf_bwdif: Move DSP code to a new file
Otherwise checkasm/vf_bwdif.c pulls in vf_bwdif.c and
then all of libavfilter. Besides being bad size-wise
this also has the downside that it pulls in
avpriv_(cga|vga16)_font from libavutil which are marked
as being imported from another library when building
libavfilter as a DLL and this breaks checkasm because
it links both lavfi and lavu statically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-28 00:17:47 +02:00
Andreas Rheinhardt 80afcc8539 avfilter/bwdif: Add proper BWDIFDSPContext
This already avoids unnecessary indirectly included headers
in the arch-specific vf_bwdif_init.c files; it is also in
preparation for splitting the actual functions out of vf_bwdif.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-28 00:17:47 +02:00
Kyle Swanson 7f685d0f49 avfilter: add libvmaf_cuda
Signed-off-by: Kyle Swanson <kswanson@netflix.com>
2023-09-27 10:22:33 -07:00
Wenbin Chen 58b6c0c327 libavfilter/dnn: Initialze DNNData variables
Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-09-27 12:58:55 +08:00
Wenbin Chen c8c925dc29 libavfilter/dnn: Add scale and mean preprocess to openvino backend
Dnn models has different data preprocess requirements. Scale and mean
parameters are added to preprocess input data.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-09-27 12:58:55 +08:00
Wenbin Chen 74ce1d2d11 libavfilter/dnn: add layout option to openvino backend
Dnn models have different input layout (NCHW or NHWC), so a
"layout" option is added
Use openvino's API to do layout conversion for input data. Use swscale
to do layout conversion for output data as openvino doesn't have
similiar C API for output.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
2023-09-27 12:58:55 +08:00
Paul B Mahol fb05bc8eee avfilter/af_astats: extend and improve bit depth output 2023-09-25 19:07:11 +02:00
Chema Gonzalez c0f89dccc8 lavfi/vf_libvmaf: add warning when color ranges differ
The VMAF filter uses the pixel values without considering
the color ranges. This is incorrect. Patch adds a warning
so at least the user knows it.

Let's see an example.

(1) Let's get FR and LR versions of the same image.

```
$ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=full" -pix_fmt yuv420p /tmp/lena.full.y4m
$ xxd /tmp/lena.full.y4m |head
00000000: 5955 5634 4d50 4547 3220 5734 3930 2048  YUV4MPEG2 W490 H
00000010: 3439 3020 4632 353a 3120 4970 2041 303a  490 F25:1 Ip A0:
00000020: 3020 4334 3230 6a70 6567 2058 5953 4353  0 C420jpeg XYSCS
00000030: 533d 3432 304a 5045 4720 5843 4f4c 4f52  S=420JPEG XCOLOR
00000040: 5241 4e47 453d 4655 4c4c 0a46 5241 4d45  RANGE=FULL.FRAME
00000050: 0a72 7271 7070 706f 6f6e 6d6d 6c6d 6d6d  .rrqpppoonmmlmmm
00000060: 6c6e 6e6d 6d6e 6e6e 6d6c 6d6d 6d6d 6d6d  lnnmmnnnmlmmmmmm
00000070: 6d6e 6d6b 6c6d 6e6e 6d6c 6d6d 6e6e 6f6f  mnmklmnnmlmmnnoo
00000080: 6f6f 6e6e 6e6e 6f70 7172 7375 7676 7370  oonnnnopqrsuvvsp
00000090: 6d69 6662 5e59 534d 4845 3d35 302e 2d2c  mifb^YSMHE=50.-,
```

```
$ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=limited" -pix_fmt yuv420p /tmp/lena.limited.y4m
$ xxd /tmp/lena.limited.y4m | head
00000000: 5955 5634 4d50 4547 3220 5734 3930 2048  YUV4MPEG2 W490 H
00000010: 3439 3020 4632 353a 3120 4970 2041 303a  490 F25:1 Ip A0:
00000020: 3020 4334 3230 6a70 6567 2058 5953 4353  0 C420jpeg XYSCS
00000030: 533d 3432 304a 5045 4720 5843 4f4c 4f52  S=420JPEG XCOLOR
00000040: 5241 4e47 453d 4c49 4d49 5445 440a 4652  RANGE=LIMITED.FR
00000050: 414d 450a 7272 7170 7070 6f6f 6e6e 6e6d  AME.rrqpppoonnnm
00000060: 6e6e 6e6d 6f6e 6e6e 6e6e 6e6e 6d6e 6e6e  nnnmonnnnnnnmnnn
00000070: 6e6e 6e6e 6f6e 6c6d 6e6f 6e6e 6d6e 6e6f  nnnnonlmnonnmnno
00000080: 6f6f 6f6f 6f6f 6f6f 6f6f 7071 7273 7576  oooooooooopqrsuv
00000090: 7673 706e 6a68 6461 5c57 524e 4b44 3d39  vspnjhda\WRNKD=9
```

Note that the 2x images are the same. Only difference is the range,
and the precision issues related to range conversion.

(2) Let's calculate the VMAF score:
```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/lena.full.y4m -i /tmp/lena.limited.y4m -lavfi libvmaf="model=path=/usr/share/model/vmaf_v0.6.1neg.json" -report -f null -
...
[Parsed_libvmaf_0 @ 0x3cc9b40] VMAF score: 85.530109
```

As we are comparing an image with itself, we expect the score to
be close to 100. Issue here is that the VMAF filter just uses the
pixel values, ignoring the color ranges.

Proposed solution is to add a warning.
```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/lena.full.y4m -i /tmp/lena.limited.y4m -lavfi libvmaf="model=path=/us
r/share/model/vmaf_v0.6.1neg.json" -report -f null -
...
[Parsed_libvmaf_0 @ 0x3cc9b40] distorted and reference frames use different color ranges (pc != tv)
...
[Parsed_libvmaf_0 @ 0x3cc9b40] VMAF score: 85.530109
```

Tested:

Ran fate.
```
$ make fate -j
...
TEST    seek-lavf-ppmpipe
TEST    seek-lavf-pgmpipe
TEST    seek-lavf-mxf_opatom
```
2023-09-23 15:55:50 +01:00
Chema Gonzalez a53545a374 lavfi/vf_ssim: add warning when color ranges differ
The SSIM filter uses the pixel values without considering
the color ranges. This is incorrect. Patch adds a warning
so at least the user knows it.

Let's see an example.

(1) Let's get FR and LR versions of the same image.

```
$ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=full" -pix_fmt yuv420p /tmp/lena.full.y4m
$ xxd /tmp/lena.full.y4m |head
00000000: 5955 5634 4d50 4547 3220 5734 3930 2048  YUV4MPEG2 W490 H
00000010: 3439 3020 4632 353a 3120 4970 2041 303a  490 F25:1 Ip A0:
00000020: 3020 4334 3230 6a70 6567 2058 5953 4353  0 C420jpeg XYSCS
00000030: 533d 3432 304a 5045 4720 5843 4f4c 4f52  S=420JPEG XCOLOR
00000040: 5241 4e47 453d 4655 4c4c 0a46 5241 4d45  RANGE=FULL.FRAME
00000050: 0a72 7271 7070 706f 6f6e 6d6d 6c6d 6d6d  .rrqpppoonmmlmmm
00000060: 6c6e 6e6d 6d6e 6e6e 6d6c 6d6d 6d6d 6d6d  lnnmmnnnmlmmmmmm
00000070: 6d6e 6d6b 6c6d 6e6e 6d6c 6d6d 6e6e 6f6f  mnmklmnnmlmmnnoo
00000080: 6f6f 6e6e 6e6e 6f70 7172 7375 7676 7370  oonnnnopqrsuvvsp
00000090: 6d69 6662 5e59 534d 4845 3d35 302e 2d2c  mifb^YSMHE=50.-,
```

```
$ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=limited" -pix_fmt yuv420p /tmp/lena.limited.y4m
$ xxd /tmp/lena.limited.y4m | head
00000000: 5955 5634 4d50 4547 3220 5734 3930 2048  YUV4MPEG2 W490 H
00000010: 3439 3020 4632 353a 3120 4970 2041 303a  490 F25:1 Ip A0:
00000020: 3020 4334 3230 6a70 6567 2058 5953 4353  0 C420jpeg XYSCS
00000030: 533d 3432 304a 5045 4720 5843 4f4c 4f52  S=420JPEG XCOLOR
00000040: 5241 4e47 453d 4c49 4d49 5445 440a 4652  RANGE=LIMITED.FR
00000050: 414d 450a 7272 7170 7070 6f6f 6e6e 6e6d  AME.rrqpppoonnnm
00000060: 6e6e 6e6d 6f6e 6e6e 6e6e 6e6e 6d6e 6e6e  nnnmonnnnnnnmnnn
00000070: 6e6e 6e6e 6f6e 6c6d 6e6f 6e6e 6d6e 6e6f  nnnnonlmnonnmnno
00000080: 6f6f 6f6f 6f6f 6f6f 6f6f 7071 7273 7576  oooooooooopqrsuv
00000090: 7673 706e 6a68 6461 5c57 524e 4b44 3d39  vspnjhda\WRNKD=9
```

Note that the 2x images are the same. Only difference is the range,
and the precision issues related to range conversion.

(2) Let's calculate the SSIM score:
```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/lena.full.y4m -i /tmp/lena.limited.y4m -lavfi "ssim" -f null -
...
[Parsed_ssim_0 @ 0x360ab00] SSIM Y:0.942347 (12.391801) U:0.995808 (23.776062) V:0.996104 (24.093747) All:0.960217 (14.003012)
```

As we are comparing an image with itself, we expect "Y: 1" as the
luma SSIM. Issue here is that the SSIM filter just uses the pixel
values, ignoring the color ranges.

Proposed solution is to add a warning.
```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/foo.full.y4m -i /tmp/foo.limited.y4m -lavfi "ssim" -f null -
...
[Parsed_ssim_0 @ 0x3766280] master and reference frames use different color ranges (pc != tv)
...
[Parsed_ssim_0 @ 0x3766280] SSIM Y:0.000000 (0.000000) U:0.000000 (0.000000) V:0.000000 (0.000000) All:0.000000 (0.000000)
```

Tested:

Ran fate.
```
$ make fate -j
...
TEST    seek-lavf-ppmpipe
TEST    seek-lavf-pgmpipe
TEST    seek-lavf-mxf_opatom
```
2023-09-23 15:55:47 +01:00
Chema Gonzalez 7311fcc869 lavfi/vf_psnr: add warning when color ranges differ
The PSNR filter uses the pixel values without considering
the color ranges. This is incorrect. Patch adds a warning
so at least the user knows it.

Let's see an example:

(1) Let's get a simple black pixel/white pixel image.
```
$ echo -n -e "\x00\x00\x00\xff\xff\xff" > /tmp/foo.rgb24
```

(2) From this image, let's distill full and limited range y4m
copies.

```
$ ffmpeg -y -f rawvideo -video_size 2x1 -pix_fmt rgb24 -i /tmp/foo.rgb24 -vf scale="out_range=full" -pix_fmt yuv420p /tmp/foo.full.y4m
$ xxd /tmp/foo.full.y4m
00000000: 5955 5634 4d50 4547 3220 5732 2048 3120  YUV4MPEG2 W2 H1
00000010: 4632 353a 3120 4970 2041 303a 3020 4334  F25:1 Ip A0:0 C4
00000020: 3230 6a70 6567 2058 5953 4353 533d 3432  20jpeg XYSCSS=42
00000030: 304a 5045 4720 5843 4f4c 4f52 5241 4e47  0JPEG XCOLORRANG
00000040: 453d 4655 4c4c 0a46 5241 4d45 0a00 ff80  E=FULL.FRAME....
00000050: 80                                       .
```

and

```
$ ffmpeg -y -f rawvideo -video_size 2x1 -pix_fmt rgb24 -i /tmp/foo.rgb24 -vf scale="out_range=limited" -pix_fmt yuv420p /tmp/foo.limited.y4m
$ xxd /tmp/foo.limited.y4m
00000000: 5955 5634 4d50 4547 3220 5732 2048 3120  YUV4MPEG2 W2 H1
00000010: 4632 353a 3120 4970 2041 303a 3020 4334  F25:1 Ip A0:0 C4
00000020: 3230 6a70 6567 2058 5953 4353 533d 3432  20jpeg XYSCSS=42
00000030: 304a 5045 4720 5843 4f4c 4f52 5241 4e47  0JPEG XCOLORRANG
00000040: 453d 4c49 4d49 5445 440a 4652 414d 450a  E=LIMITED.FRAME.
00000050: 10eb 8080                                ....
```

Note that the 2x images are the same (both have 1x pixel at the
darkest black, and one at the brightest white). Only difference
is the range.

(3) Let's calculate the PSNR score:
```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/foo.full.y4m -i /tmp/foo.limited.y4m -lavfi "psnr" -f null -
...
[Parsed_psnr_0 @ 0x2f5dac0] PSNR y:22.972065 u:inf v:inf average:25.982365 min:25.982365 max:25.982365
```

As we are comparing an image with itself, we expect "y:inf" as the
luma PSNR. Issue here is that the PSNR filter just uses the pixel
values, ignoring the color ranges.

A possible solution would be to have the filter do the conversion.

Proposed solution is to add a warning.

```
$ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/foo.full.y4m -i /tmp/foo.limited.y4m -lavfi "psnr" -f null -
...
[Parsed_psnr_0 @ 0x2f5dac0] master and reference frames use different color ranges (pc != tv)
...
[Parsed_psnr_0 @ 0x2f5dac0] PSNR y:22.972065 u:inf v:inf average:25.982365 min:25.982365 max:25.982365
```

Tested:

Ran fate.
```
$ make fate -j
...
TEST    seek-lavf-ppmpipe
TEST    seek-lavf-pgmpipe
TEST    seek-lavf-mxf_opatom
```
2023-09-23 15:55:44 +01:00
Paul B Mahol 1242d172e2 avfilter: use ptrdiff_t instead of int for linesize
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2023-09-22 22:56:57 +02:00
Zhao Zhili 3951c1899e avfilter/vf_smartblur: pass old context to sws_getCachedContext
Otherwise it make no sense to use sws_getCachedContext.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-20 23:24:55 +08:00
Paul B Mahol c5effe7d3d avfilter/x86/af_afir: add FMA3 SIMD 2023-09-17 11:11:24 +02:00
Zhao Zhili 4f4dc0a1a2 avfilter/dnn_backend_openvino: fix wild pointer on error path
When ov_model_const_input_by_name/ov_model_const_output_by_name
failed, input_port/output_port can be wild pointer.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili 791b88fcb4 avfilter/dnn_backend_openvino: fix input_port/output_port leaks 2023-09-15 13:02:15 +08:00
Zhao Zhili 37123100d2 avfilter/dnn_backend_openvino: fix leak of ov_shape_t 2023-09-15 13:02:15 +08:00
Zhao Zhili d2c5c3b7ef avfilter/dnn_backend_openvino: fix leak or ov_core_t on error path 2023-09-15 13:02:15 +08:00
Zhao Zhili e0880ef8cb avfilter/dnn_backend_openvino: fix use uninitialized values
Error handling was broken since neither `ret` nor `task` has being
initialized on error path.
2023-09-15 13:02:15 +08:00
Zhao Zhili 7cb6329296 avfilter/dnn_backend_openvino: reduce indentation in free_model_ov
No functional changes except ensures model isn't null.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili 5369548f2e avfilter/dnn_backend_openvino: fix multiple memleaks
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00
Zhao Zhili 3e24a27765 avfilter/dnn_filter_common: fix memleak
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-09-15 13:02:15 +08:00