Commit Graph

7059 Commits

Author SHA1 Message Date
Paul B Mahol 5d8df3cc4a Update Changelog for lensfun addition and bump minor 2018-07-15 10:23:20 +02:00
Stephen Seo 0ea20124b7 Add lensfun filter
Lensfun is a library that applies lens correction to an image using a
database of cameras/lenses (you provide the camera and lens models, and
it uses the corresponding database entry's parameters to apply lens
correction). It is licensed under LGPL3.

The lensfun filter utilizes the lensfun library to apply lens
correction to videos as well as images.

This filter was created out of necessity since I wanted to apply lens
correction to a video and the lenscorrection filter did not work for me.

While this filter requires little info from the user to apply lens
correction, the flaw is that lensfun is intended to be used on indvidual
images. When used on a video, the parameters such as focal length is
constant, so lens correction may fail on videos where the camera's focal
length changes (zooming in or out via zoom lens). To use this filter
correctly on videos where such parameters change, timeline editing may
be used since this filter supports it.

Note that valgrind shows a small memory leak which is not from this
filter but from the lensfun library (memory is allocated when loading
the lensfun database but it somehow isn't deallocated even during
cleanup; it is briefly created in the init function of the filter, and
destroyed before the init function returns). This may have been fixed by
the latest commit in the lensfun repository; the current latest release
of lensfun is almost 3 years ago.

Bi-Linear interpolation is used by default as lanczos interpolation
shows more artifacts in the corrected image in my tests.

The lanczos interpolation is derived from lenstool's implementation of
lanczos interpolation. Lenstool is an app within the lensfun repository
which is licensed under GPL3.

v2 of this patch fixes license notice in libavfilter/vf_lensfun.c

v3 of this patch fixes code style and dependency to gplv3 (thanks to
Paul B Mahol for pointing out the mentioned issues).

v4 of this patch fixes more code style issues that were missed in
v3.

v5 of this patch adds line breaks to some of the documentation in
doc/filters.texi (thanks to Gyan Doshi for pointing out the issue).

v6 of this patch fixes more problems (thanks to Moritz Barsnick for
pointing them out).

v7 of this patch fixes use of sqrt() (changed to sqrtf(); thanks to
Moritz Barsnick for pointing this out). Also should be rebased off of
latest master branch commits at this point.

Signed-off-by: Stephen Seo <seo.disparate@gmail.com>
2018-07-15 10:07:54 +02:00
Gyan Doshi 1a31c2b5df avfilter/drawtext: fix box sizing
At present, box size is clipped to frame size before being drawn,
which can lead to the box not fully covering animated text which is
longer than one or both frame dimensions.

Since ff_blend_rectangle correctly takes care of clipping, it is skipped
here which results in correct box sizing
2018-07-13 10:11:15 +05:30
Danil Iashchenko 7cd58a8a8c lavfi/convolution_opencl: use CL_FAIL_ON_ERROR for error handling
Switch to use CL_FAIL_ON_ERROR for error handling
2018-07-12 23:28:46 +01:00
Danil Iashchenko 2bdb6b6496 lavfi/avgblur_opencl: fix using uninitialized value
Fixed using uninitialized value "global_work[0]" when calling "av_log".

Fixes CID #1437471.
2018-07-11 23:17:04 +01:00
Ruiling Song 923ee63d6c lavfi/vf_avgblur_opencl: remove useless clFinish().
The very last clFinish() should be ok.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Danil Iashchenko <danyaschenko@gmail.com>
2018-07-11 23:05:02 +01:00
Ruiling Song 48a1abed13 lavfi/opencl: add macro for opencl error handling.
Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-07-11 23:03:46 +01:00
Jun Zhao eb776a16ea lavfi/minterpolate: fix blending calc issue.
the right blending calc is:
(alpha * Frame_2 + (MAX - alpha) * Frame_1 + 512) >> 10

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-07-08 23:05:34 +08:00
Gyan Doshi c71e1e6030 avfilter/setpts: add FR shorthand for FRAME_RATE 2018-07-07 21:08:08 +05:30
Shlomi Fish 1ecdcb61b0 lavfi/weave: Refactor two near-identical clauses.
The changes contained in this patch are hereby placed under the Expat licence.

Reviewed-by: Paul B Mahol
2018-07-04 18:48:10 +02:00
Danil Iashchenko 581bafa83b lavfi: add sobel, prewitt, roberts filters
Add opencl version of sobel, prewitt, roberts filters.
2018-07-03 00:11:28 +01:00
Pedro Arthur 54b425a7fa libavfilter: vf_sr.c remove warnings 2018-07-02 13:45:38 -03:00
Sergey Lavrushkin 575b718990 Adds ESPCN super resolution filter merged with SRCNN filter.
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2018-07-02 10:47:14 -03:00
Mark Thompson 46fb150a81 lavfi/colorspace: Add namespace prefix to global functions 2018-06-28 16:14:35 +01:00
Mark Thompson bd02b2c05d lavfi/vf_tonemap_opencl: Mark local tables static 2018-06-25 21:00:54 +01:00
Mark Thompson d4d29052c3 lavfi/framesync: Add namespace prefix to framesync_get_class 2018-06-24 19:39:01 +01:00
Ruiling Song 649d7ca477 lavfi: make vf_colorspace use functions from colorspace.c
These functions are shared among colorspace related filters.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-06-21 01:19:25 +01:00
Ruiling Song 8b8b0e2cd2 lavfi: add opencl tonemap filter
This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping.

An example command to use this filter with vaapi codecs:
FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \
opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \
vaapi -i INPUT -filter_hw_device ocl -filter_complex \
'[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \
[x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 OUTPUT

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
2018-06-21 01:19:18 +01:00
Danil Iashchenko 714da1fd89 lavfi: Add boxblur_opencl filter
Behaves like existing boxblur filter.
2018-06-21 00:31:42 +01:00
Danil Iashchenko b41b6b3234 libavfilter/opencl: Add macro for setting opencl kernel arguments 2018-06-17 17:58:17 +01:00
Jun Zhao 483532bc72 lavfi/graphdump: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 09:59:33 +08:00
Jun Zhao 9809ac98bd lavfi/af_amerge: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 09:59:33 +08:00
Pavel Koshevoy 29cddc99cd lavfi/atempo: raise max tempo limit (v2) 2018-06-14 19:19:17 -06:00
Sergey Lavrushkin 648361c2fa libavfilter/dnn_interface.c: fix av_freep dnn_module.
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2018-06-08 10:26:08 -03:00
Sergey Lavrushkin d29c35b4d8 libavfilter/vf_srcnn.c: adds DNN module backend AVOption, changes AV_LOG_INFO message to AV_LOG_VERBOSE.
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2018-06-08 10:26:08 -03:00
Jun Zhao 3161df5b0c lavfi/opencl: remove redundant header.
remove redundant header

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-07 19:38:58 +08:00
Sergey Lavrushkin d8c0bbb0aa Adds TensorFlow backend for dnn inference module.
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2018-06-05 10:16:50 -03:00
Vishwanath Dixit 37abfe8c2d avfilter/drawtext: present 'hms' formatted 'pts' in 24h format
HMS is formatted as HH:MM:SS.mmm, but, HH part is not limited to
24 hours. For example, the the drawn text may look like this:
243029:20:30.342. To present the timestamp in more readable and
user friendly format, this patch provides an additional option
to limit the hour part in the range 0-23.

Note: Actually the above required format can be obtained with
format options 'localtime' and 'gmtime', but,  milliseconds part
is not supported in those formats.
2018-06-04 10:57:45 +05:30
Paul B Mahol 29e0879b29 avfilter/f_drawgraph: fix drawing of first point for non-first metadata key
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-03 18:50:04 +02:00
Paul B Mahol 9832885386 avfilter/vf_zoompan: do not increase VAR_IN twice, also count from 0
Fixes #7242.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-03 14:57:25 +02:00
Paul B Mahol 49eda27c6e avfilter/avf_showspectrum: also show sample rate and channel layout
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-03 12:43:43 +02:00
Paul B Mahol 9add1786ad avfilter/avf_showspectrum: avoid overwritting text
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-03 12:26:43 +02:00
Paul B Mahol d0bf1aa3c5 avfilter/avf_showspectrum: improve axes drawing
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-03 12:06:35 +02:00
Paul B Mahol af31084399 avfilter/vf_lut3d: unbreak haldclut with planar rgb formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-02 19:16:22 +02:00
Jan Ekström 76daf4529b lavfi/Makefile: move dnn_*.o under vf_srcnn
These files depend on libavformat, and the vf_srcnn filter
currently is the only thing utilizing these dnn_* files and
already happens to have a dependency on libavformat.

This fixes compilation in cases where libavformat is not a
dependency for libavfilter.

Reported by Kam_ on IRC.
2018-06-02 19:00:57 +03:00
Paul B Mahol e28b1fa6e9 avfilter: add adeclick and adeclip audio filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-06-02 13:09:06 +02:00
John Cox 8d4fc2ea06 avfilter: use av_clip_uintp2_c where clip is variable
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-31 16:22:59 +02:00
Paul B Mahol 1aa5192451 avfilter/af_aiir: draw IR frequency response
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-30 17:26:08 +02:00
Paul B Mahol d0e740b8fb avfilter/af_afir: fix picking of IR channel
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-30 12:30:24 +02:00
Paul B Mahol 73438dbbbc avfilter/af_afir: draw IR frequency response
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-29 21:57:42 +02:00
Sergey Lavrushkin bdf1bbdbb4 Adds dnn inference module for simple convolutional networks. Reimplements srcnn filter based on it.
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2018-05-29 10:02:30 -03:00
James Almer 79126ce80e avfilter/vsrc_testsrc: fix a preprocessor check
Signed-off-by: James Almer <jamrial@gmail.com>
2018-05-18 17:42:57 -03:00
Tobias Rapp eb28b5ec8a avfilter/vsrc_testsrc: add pal75bars and pal100bars video filter sources
Generates color bar test patterns based on EBU PAL recommendations.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-05-18 15:39:54 +02:00
Paul B Mahol e9dd5b4f5e avfilter/vf_waveform: add slice threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-18 13:15:09 +02:00
Paul B Mahol 4e816b5491 avfilter: add aderivative and aintegral filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-16 12:20:38 +02:00
Paul B Mahol 2bde38c0ab avfilter/vf_lut2: add timeline support to tlut2 filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-14 18:26:16 +02:00
Paul B Mahol a27cab9eca avfilter/vf_blend: add timeline support to tblend filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-14 18:08:35 +02:00
Paul B Mahol 80b474875e avfilter/vf_srcnn: use function to get number of threads
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-14 16:04:33 +02:00
Paul B Mahol e3a697eda3 avfilter/vf_amplify: check if array is availabe before using it
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-14 16:04:33 +02:00
Paul B Mahol 1c2e5fc454 avfilter/vf_maskedmerge: add slice threading
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-05-12 15:46:28 +02:00