[FFmpeg-devel] [PATCH v2] avfilter: add libdewobble_opencl filter

Daniel Playfair Cal daniel.playfair.cal at gmail.com
Tue Aug 24 05:43:34 EEST 2021


On Tue, Aug 24, 2021 at 3:09 AM Paul B Mahol <onemda at gmail.com> wrote:
> library is named dewobble, thus filter should be libdewobble.

Lynne suggested "libdewobble_opencl". I can rename it to "libdewobble"
if you prefer, but will everyone be happy with that?

Perhaps it will be easier if you explain the convention and your
reasoning for the name. All the other filters which work with OpenCL
hardware frames are postfixed with "_opencl". All the other filters
which wrap external libraries are not prefixed with "lib" (with the
exception of "libvmaf"). Why is this filter different in both senses?

> no, libdewobble video filter

OK, I will update this to match the name of the filter, whatever that is.

>> +
>> +/**
>> + * Camera properties, mirroring those present in libdewobble's camera object.
>> + */
>> +typedef struct Camera {
>> +    /**
>> +     * Camera projection model, e.g. `DEWOBBLE_PROJECTION_RECTILINEAR`
>> +     */
>> +    int model;
>> +
>> +    /**
>> +     * Camera diagonal field of view in degrees
>> +     */
>> +    double diagonal_fov;
>> +
>> +    /**
>> +     * Width in pixels
>> +     */
>> +    int width;
>> +
>> +    /**
>> +     * Height in pixels
>> +     */
>> +    int height;
>> +
>> +    /**
>> +     * Horizonal coordinate of focal point in pixels
>> +     */
>> +    double focal_point_x;
>> +
>> +    /**
>> +     * Vertical coordinate of focal point in pixels
>> +     */
>> +    double focal_point_y;
>> +} Camera;
>> +
>> +/**
>> + * Motion stabilization algorithm, mirroring those available in libdewobble.
>> + */
>> +typedef enum StabilizationAlgorithm {
>> +
>> +    /**
>> +     * Do not apply stabilization
>> +     */
>> +    STABILIZATION_ALGORITHM_ORIGINAL,
>> +
>> +    /**
>> +     * Keep the camera orientation fixed at its orientation in the first frame
>> +     */
>> +    STABILIZATION_ALGORITHM_FIXED,
>> +
>> +    /**
>> +     * Smooth camera orientation with a Savitsky-Golay filter
>> +     */
>> +    STABILIZATION_ALGORITHM_SMOOTH,
>> +
>> +    /**
>> +     * Number of stabilization algorithms
>> +     */
>> +    NB_STABILIZATION_ALGORITHMS,
>> +
>> +} StabilizationAlgorithm;
>> +
>
>
> Huh? Why this and bellow similar stuff are not part of library?


Because the FFmpeg filter options work by writing values to offsets in
memory, but this is not supported in libdewobble. So there are
intermediate structs/enums in the filter context where options are
written to, which are later passed to the libdewobble API in the
appropriate way. e.g. see the use of dewobble_filter_config_create()
and stabilization_algorithm.

> Apply ....

Ok, will fix.

> I really dislike GPL3 and use of opencv.
> I would prefer pure C solution.

You are welcome to use the same ideas and write a native C filter with
LGPL license if you want. But there will be alot more code to write.
OpenCV provides sparse optical flow, RANSAC, warping with 5
interpolation algorithms, text/shape drawing utilities, etc. And most
of these with OpenCL acceleration or optimized multithreaded CPU
implementations.

Use of OpenCV is an implementation detail of libdewobble. OpenCV is
not used directly in the filter, and no OpenCV objects are passed to
or received from libdewobble.


More information about the ffmpeg-devel mailing list