Commit Graph

588 Commits

Author SHA1 Message Date
Wu Jianhua
9a194252c7 avfilter: add a blend_vulkan filter
This commit adds a blend_vulkan filter and a normal blend mode, and
reserves support for introducing the blend modes in the future.

Use the commands below to test: (href: https://trac.ffmpeg.org/wiki/Blend)
I. make an image for test
ffmpeg -f lavfi -i color=s=256x256,geq=r='H-1-Y':g='H-1-Y':b='H-1-Y' -frames 1 \
-y -pix_fmt yuv420p test.jpg

II. blend in sw
ffmpeg -i test.jpg -vf "split[a][b];[b]transpose[b];[a][b]blend=all_mode=normal,\
pseudocolor=preset=turbo" -y normal_sw.jpg

III. blend in vulkan
ffmpeg -init_hw_device vulkan -i test.jpg -vf "split[a][b];[b]transpose[b];\
[a]hwupload[a];[b]hwupload[b];[a][b]blend_vulkan=all_mode=normal,hwdownload,\
format=yuv420p,pseudocolor=preset=turbo" -y normal_vulkan.jpg

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2022-01-05 15:16:22 +01:00
Andreas Rheinhardt
ab54956edd configure: Add new mpegvideodec CONFIG_EXTRA
This allows to remove the spurious dependencies of mpegvideo encoders
on error_resilience; some other components that do not use mpegvideo
to its fullest turned out to not need it either.

Adding a new CONFIG_EXTRA needs a reconfigure to take effect.
In order to force this a few unnecessary headers from lavfi/allfilters.c
have been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 16:28:55 +01:00
Paul B Mahol
209488ccb0 avfilter: add anlmf filter 2021-12-25 11:32:41 +01:00
Aman Karmani
4ac869ca2a avfilter: add vf_yadif_videotoolbox
deinterlaces CVPixelBuffers, i.e. AV_PIX_FMT_VIDEOTOOLBOX frames

for example, an interlaced mpeg2 video can be decoded by avcodec,
uploaded into a CVPixelBuffer, deinterlaced by Metal, and then
encoded to h264 by VideoToolbox as follows:

    ffmpeg \
           -init_hw_device videotoolbox \
           -i interlaced.ts \
           -vf hwupload,yadif_videotoolbox \
           -c:v h264_videotoolbox \
           -b:v 2000k \
           -c:a copy \
           -y progressive.ts

(note that uploading AVFrame into CVPixelBuffer via hwupload
 requires 504c60660d)

this work is sponsored by Fancy Bits LLC

Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-12-18 11:57:31 -08:00
Paul B Mahol
996b13fac4 avfilter: add audio dynamic equalizer filter 2021-12-12 10:47:28 +01:00
Wu Jianhua
58816f6927 avfilter: add a transpose_vulkan filter
The following command is on how to apply transpose_vulkan filter:
ffmpeg -init_hw_device vulkan -i input.264 -vf \
hwupload=extra_hw_frames=16,transpose_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-10 16:48:20 +01:00
Anton Khirnov
944c34a94c lavfi/allfilters: move vf_chromaber_vulkan to video section 2021-12-04 14:06:42 +01:00
Wu Jianhua
bdfb0e4da4 avfilter: add a flip_vulkan filter
This filter flips the input video both horizontally and vertically
in one compute pipeline, and it's no need to use two pipelines for
hflip_vulkan,vflip_vulkan anymore.

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-12-02 11:06:24 +01:00
Paul B Mahol
fc9a686688 avfilter: add audio dynamic smooth filter 2021-12-02 09:39:27 +01:00
Paul B Mahol
11b11577fe avfilter: add audio spectral stats filter 2021-12-02 09:35:36 +01:00
Wu Jianhua
3188b606d7 avfilter: add a vflip_vulkan filter
The following command is on how to apply vflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,vflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:48 +01:00
Wu Jianhua
d313cb5a2f avfilter: add a hflip_vulkan filter
The following command is on how to apply hflip_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,hflip_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-19 16:47:48 +01:00
Paul B Mahol
d401b1ccec avfilter: add colorspectrum source video filter 2021-11-16 20:41:39 +01:00
Wu Jianhua
5fc935c7fa libavfilter: add a gblur_vulkan filter
This commit adds a powerful and customizable gblur Vulkan filter,
which provides a maximum 127x127 kernel size of Gaussian Filter.
The size could be adjusted by requirements on quality or performance.

The following command is on how to apply gblur_vulkan filter:

ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,gblur_vulkan,hwdownload,format=yuv420p output.264

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
2021-11-16 10:32:21 +01:00
Niklas Haas
51e03409d7 lavfi: add a libplacebo filter
This filter conceptually maps the libplacebo `pl_renderer` API into
libavfilter, which is a high-level image rendering API designed to work
with an RGB pipeline internally. As such, there's no way to avoid e.g.
chroma interpolation with this filter, although new versions of
libplacebo support outputting back to subsampled YCbCr after processing
is done.

That being said, `pl_renderer` supports automatic integration of the
majority of libplacebo's shaders, ranging from debanding to tone
mapping, and also supports loading custom mpv-style user shaders, making
this API a natural candidate for getting a lot of functionality out of
relatively little code.

In the future, I may approach this problem either by rewriting this
filter to also support a non-renderer codepath, or by upgrading
libplacebo's renderer to support a full YCbCr pipeline.

This unfortunately requires a very new version of libplacebo (unreleased
at time of writing) for timeline semaphore support. But the amount of
boilerplate needed to hack in backwards compatibility would have been
very unreasonable.
2021-11-12 14:45:36 +01:00
Roman Arzumanyan
08a501946f avfilter/scale_npp: add scale2ref_npp filter
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-11-03 19:06:14 +01:00
Paul B Mahol
8164fe1139 avfilter: add huesaturation filter 2021-10-29 23:18:27 +02:00
Paul B Mahol
407acc0747 avfilter: add varblur video filter 2021-10-19 08:53:56 +02:00
Paul B Mahol
933765aa0e avfilter: add xcorrelate video filter 2021-10-13 19:09:21 +02:00
Paul B Mahol
32eaf4069e avfilter: add limitdiff video filter 2021-10-13 19:02:34 +02:00
Paul B Mahol
8f26ebde14 avfilter: add audio signal to distortion ratio filter 2021-10-09 14:10:09 +02:00
Roman Arzumanyan
ed084161ba avfilter/sharpen_npp: add sharpening video filter with borders control
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2021-10-07 18:07:53 +02:00
Paul B Mahol
ba63078b0f avfilter: add (a)latency filters 2021-10-02 18:49:40 +02:00
Paul B Mahol
b2ec4edef7 avfilter: add morpho filter 2021-09-28 22:57:33 +02:00
Paul B Mahol
eeab62ad2d avfilter: add audio psychoacoustic clipper 2021-09-11 16:19:40 +02:00
Paul B Mahol
463c71b3b3 avfilter/vf_convolution: add scharr operator 2021-09-10 18:43:51 +02:00
Paul Buxton
e07ada3dac avfilter: add grayworld video filter
Implements a gray world color correction algorithm
using a log scale LAB colorspace.

Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2021-08-29 13:31:37 +02:00
Paul B Mahol
1da2dd5c77 avfilter: add atilt filter 2021-08-28 18:51:04 +02:00
Paul B Mahol
b53a7d2d4d avfilter: add adecorrelate filter 2021-08-28 18:46:39 +02:00
Paul B Mahol
02aa7dc423 avfilter: add hsvkey and hsvhold video filters 2021-08-25 20:43:18 +02:00
Paul B Mahol
8567f1c392 avfilter: add (a)segment filters 2021-08-16 20:26:04 +02:00
Paul B Mahol
6846d48fa6 avfilter: add afwtdn filter 2021-07-24 12:24:40 +02:00
Xuewei Meng
f8d910e90f GSoC: Add guided filter
Add examples on how to use this filter, and improve the code style.
Implement the slice-level parallelism for guided filter.
Add the basic version of guided filter.

Signed-off-by: Xuewei Meng <xwmeng96@gmail.com>
Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
2021-05-10 13:34:29 +08:00
Guo, Yejun
41ef57fdb2 lavfi/dnn_classify: add filter dnn_classify for classification based on detection bounding boxes
classification is done on every detection bounding box in frame's side data,
which are the results of object detection (filter dnn_detect).

Please refer to commit log of dnn_detect for the material for detection,
and see below for classification.

- download material for classifcation:
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.bin
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.xml
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/emotions-recognition-retail-0003.label

- run command as:
./ffmpeg -i cici.jpg -vf dnn_detect=dnn_backend=openvino:model=face-detection-adas-0001.xml:input=data:output=detection_out:confidence=0.6:labels=face-detection-adas-0001.label,dnn_classify=dnn_backend=openvino:model=emotions-recognition-retail-0003.xml:input=data:output=prob_emotion:confidence=0.3:labels=emotions-recognition-retail-0003.label:target=face,showinfo -f null -

We'll see the detect&classify result as below:
[Parsed_showinfo_2 @ 0x55b7d25e77c0]   side data - detection bounding boxes:
[Parsed_showinfo_2 @ 0x55b7d25e77c0] source: face-detection-adas-0001.xml, emotions-recognition-retail-0003.xml
[Parsed_showinfo_2 @ 0x55b7d25e77c0] index: 0,  region: (1005, 813) -> (1086, 905), label: face, confidence: 10000/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0]            classify:  label: happy, confidence: 6757/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0] index: 1,  region: (888, 839) -> (967, 926), label: face, confidence: 6917/10000.
[Parsed_showinfo_2 @ 0x55b7d25e77c0]            classify:  label: anger, confidence: 4320/10000.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-05-06 10:50:44 +08:00
Andreas Rheinhardt
a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Andreas Rheinhardt
420cedd497 libavresample: Remove deprecated library
Deprecated in c29038f304.
The resample filter based upon this library has been removed as well.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Andreas Rheinhardt
ec82ff89b6 avfilter: Remove avfilter_next/avfilter_register API
Deprecated in 8f1382f80e.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:11 -03:00
Guo, Yejun
aa9ffdaa1e lavfi: add filter dnn_detect for object detection
Below are the example steps to do object detection:

1. download and install l_openvino_toolkit_p_2021.1.110.tgz from
https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html
  or, we can get source code (tag 2021.1), build and install.
2. export LD_LIBRARY_PATH with openvino settings, for example:
.../deployment_tools/inference_engine/lib/intel64/:.../deployment_tools/inference_engine/external/tbb/lib/
3. rebuild ffmpeg from source code with configure option:
--enable-libopenvino
--extra-cflags='-I.../deployment_tools/inference_engine/include/'
--extra-ldflags='-L.../deployment_tools/inference_engine/lib/intel64'
4. download model files and test image
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.bin
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.xml
wget
https://github.com/guoyejun/ffmpeg_dnn/raw/main/models/openvino/2021.1/face-detection-adas-0001.label
wget https://github.com/guoyejun/ffmpeg_dnn/raw/main/images/cici.jpg
5. run ffmpeg with:
./ffmpeg -i cici.jpg -vf dnn_detect=dnn_backend=openvino:model=face-detection-adas-0001.xml:input=data:output=detection_out:confidence=0.6:labels=face-detection-adas-0001.label,showinfo -f null -

We'll see the detect result as below:
[Parsed_showinfo_1 @ 0x560c21ecbe40]   side data - detection bounding boxes:
[Parsed_showinfo_1 @ 0x560c21ecbe40] source: face-detection-adas-0001.xml
[Parsed_showinfo_1 @ 0x560c21ecbe40] index: 0,  region: (1005, 813) -> (1086, 905), label: face, confidence: 10000/10000.
[Parsed_showinfo_1 @ 0x560c21ecbe40] index: 1,  region: (888, 839) -> (967, 926), label: face, confidence: 6917/10000.

There are two faces detected with confidence 100% and 69.17%.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-04-17 17:27:02 +08:00
Paul B Mahol
17127f81c5 avfilter: add msad video filter 2021-03-06 12:42:16 +01:00
Paul B Mahol
4a69cd4e4e avfilter: add identity video filter 2021-03-06 12:41:30 +01:00
Ashish Singh
38aea9b041 avfilter: add vif filter
This is Visual Information Fidelity (VIF) filter and one of the component
filters of VMAF. It outputs the average VIF score over all frames.

Signed-off-by: Ashish Singh <ashk43712@gmail.com>
2021-02-16 15:00:50 +01:00
Paul B Mahol
edc45d1bd5 avfilter: add monochrome video filter 2021-02-12 00:08:39 +01:00
Paul B Mahol
4390573c44 avfilter: add exposure video filter 2021-02-10 19:23:48 +01:00
Paul B Mahol
579e4e57a2 avfilter: add aexciter audio filter 2021-02-10 19:21:01 +01:00
Paul B Mahol
bd5226704a avfilter: add colorize filter 2021-02-07 11:48:28 +01:00
Paul B Mahol
f6621a8e72 avfilter: add colorcorrect filter 2021-02-03 15:49:13 +01:00
Paul B Mahol
090f31f813 avfilter: add colorcontrast filter 2021-02-02 14:27:06 +01:00
Paul B Mahol
a9d23d33a1 avfilter: add colortemperature filter 2021-01-27 11:48:00 +01:00
Paul B Mahol
35f8628047 avfilter: add kirsch video filter 2021-01-27 11:46:26 +01:00
Paul B Mahol
37f76c81d6 avfilter: add shear video filter 2021-01-26 12:19:09 +01:00