[FFmpeg-devel] [PATCH 1/2] avfilter/vf_perspective: factor the interpolation code out so that it's usable by other filters
Michael Niedermayer
michael at niedermayer.cc
Thu Jun 12 15:08:21 EEST 2025
On Thu, Jun 12, 2025 at 11:38:59AM +0200, Quentin RENARD wrote:
> As mentioned here (https://ffmpeg.org/pipermail/ffmpeg-devel/2025-June/344593.html), this is the first step of a 2 steps patch: move the interpolation code out of the vf_perspective filter so that we can use it in a new zoompan filter and apply scale/crop floating point precision there.
>
> Signed-off-by: Quentin Renard <contact-github at asticode.com>
> ---
> libavfilter/Makefile | 2 +-
> libavfilter/perspective.c | 404 +++++++++++++++++++++++++++++++++++
> libavfilter/perspective.h | 67 ++++++
> libavfilter/vf_perspective.c | 372 +++-----------------------------
> 4 files changed, 497 insertions(+), 348 deletions(-)
> create mode 100644 libavfilter/perspective.c
> create mode 100644 libavfilter/perspective.h
>
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 97f8f17272..7c6dfcf4bf 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -426,7 +426,7 @@ OBJS-$(CONFIG_PAD_OPENCL_FILTER) += vf_pad_opencl.o opencl.o opencl/
> OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o palette.o
> OBJS-$(CONFIG_PALETTEUSE_FILTER) += vf_paletteuse.o framesync.o palette.o
> OBJS-$(CONFIG_PERMS_FILTER) += f_perms.o
> -OBJS-$(CONFIG_PERSPECTIVE_FILTER) += vf_perspective.o
> +OBJS-$(CONFIG_PERSPECTIVE_FILTER) += vf_perspective.o perspective.o
> OBJS-$(CONFIG_PHASE_FILTER) += vf_phase.o
> OBJS-$(CONFIG_PHOTOSENSITIVITY_FILTER) += vf_photosensitivity.o
> OBJS-$(CONFIG_PIXDESCTEST_FILTER) += vf_pixdesctest.o
> diff --git a/libavfilter/perspective.c b/libavfilter/perspective.c
> new file mode 100644
> index 0000000000..ab200f8532
> --- /dev/null
> +++ b/libavfilter/perspective.c
[...]
> +static int perspective_resample_cubic(AVFilterContext *ctx, void *arg,
> + int job, int nb_jobs)
> +{
[...]
> +static int perspective_resample_linear(AVFilterContext *ctx, void *arg,
> + int job, int nb_jobs)
> +{
[...]
> +static int calc_luts(PerspectiveResampleContext *s, int w, int h, double ref[4][2])
> +{
[...]
> diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
> index 58510f6f13..f5766eed7a 100644
> --- a/libavfilter/vf_perspective.c
> +++ b/libavfilter/vf_perspective.c
[...]
> -static int calc_persp_luts(AVFilterContext *ctx, AVFilterLink *inlink)
[...]
> -static int resample_cubic(AVFilterContext *ctx, void *arg,
> - int job, int nb_jobs)
> -{
[...]
> -static int resample_linear(AVFilterContext *ctx, void *arg,
> - int job, int nb_jobs)
> -{
please keep the functions in the same order so that a diff between
new libavfilter/perspective.c
and
old libavfilter/vf_perspective.c
is easy readable
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250612/12bcbd05/attachment.sig>
More information about the ffmpeg-devel
mailing list