[FFmpeg-devel] [PATCH] Port mp=eq/eq2 to FFmpeg

Stefano Sabatini stefasab at gmail.com
Fri Jan 23 17:48:01 CET 2015


On date Friday 2015-01-23 20:44:01 +0530, Arwa Arif encoded:
[...]
> > Looks good otherwise, assuming it is bitexact with the mp=eq2.
> >
> 
> The default is bit-exact with mp=eq2, I can't check it with other values,
> because the range of values in mp is different from the range of values in
> this code.

What's wrong with testing with some random in-range values? Also why
do they differ?

> 
> 
> >
> > Also, what about adding expressions support (like done in hue)? (this
> > will go of course to a separate patch).
> >
> 
> What is meant by expressions support?

See for example:
75d34864d16fbf02928c319134bd94a7a7752092

> From f9610db3c8ce209b57e55e2bf778b03da8d3d4a1 Mon Sep 17 00:00:00 2001
> From: Arwa Arif <arwaarif1994 at gmail.com>
> Date: Mon, 19 Jan 2015 03:56:48 +0530
> Subject: [PATCH] Port mp=eq/eq2 to FFmpeg
> 

> Code adapted from James Darnley's port

Nit++++: incomplete sentence, final dot missing.

> ---
>  configure                |   38 +++----
>  doc/filters.texi         |   43 +++++++
>  libavfilter/Makefile     |    1 +
>  libavfilter/allfilters.c |    1 +
>  libavfilter/vf_eq.c      |  284 ++++++++++++++++++++++++++++++++++++++++++++++
>  libavfilter/vf_eq.h      |   63 ++++++++++
>  libavfilter/x86/Makefile |    1 +
>  libavfilter/x86/vf_eq.c  |   94 +++++++++++++++
>  8 files changed, 500 insertions(+), 25 deletions(-)
>  create mode 100644 libavfilter/vf_eq.c
>  create mode 100644 libavfilter/vf_eq.h
>  create mode 100644 libavfilter/x86/vf_eq.c
> 
> diff --git a/configure b/configure
> index c73562b..d122720 100755
> --- a/configure
> +++ b/configure
> @@ -60,7 +60,6 @@ show_help(){
>      cat <<EOF
>  Usage: configure [options]
>  Options: [defaults in brackets after descriptions]
> -

unrelated change, here and below

[...]  
> + at section eq
> +Set brightness, contrast, saturation and gamma adjustment.
> +
> +The filter accepts the following options:
> +
> + at table @option
> + at item brightness
> +Set the brightness value. It accepts a float value in range @code{-1.0} to
> + at code{1.0}. The default value is @code{0.0}.
> +
> + at item contrast
> +Set the contrast value. It accepts a float value in range @code{-2.0} to
> + at code{2.0}. The default value is @code{0.0}.
> +
> + at item gamma
> +Set the gamma value. It accepts a float value in range @code{0.1} to @code{10.0}.
> +The default value is @code{1.0}.
> +
> + at item gamma_y
> +Set the gamma value for the luma plane. It accepts a float value in range
> + at code{0.1} to @code{10.0}. The default value is @code{1.0}.
> +
> + at item gamma_u
> +Set the gamma value for 1st chroma plane. It accepts a float value in range
> + at code{0.1} to @code{10.0}. The default value is @code{1.0}.
> +
> + at item gamma_v
> +Set the gamma value for 2nd chroma plane. It accepts a float value in range
> + at code{0.1} to @code{10.0}. The default value is @code{1.0}.
> +
> + at item saturation
> +Set the saturation value. It accepts a float value in range @code{0.0} to
> + at code{3.0}. The default value is @code{1.0}.
> +
> + at item gamma_weight
> +Can be used to reduce the effect of a high gamma value on bright image areas,
> +e.g. keep them from getting overamplified and just plain white. It accepts a
> +float value in range @code{0.0} to @code{1.0}.A value of @code{0.0} turns the
> +gamma correction all the way down while @code{1.0} leaves it at its full strength.
> +Default is @code{1.0}.
> +
> + at end table
> +
>  @section extractplanes
>  
>  Extract color channel components from input video stream into
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index e43d76d..8e94033 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -116,6 +116,7 @@ OBJS-$(CONFIG_DRAWGRID_FILTER)               += vf_drawbox.o
>  OBJS-$(CONFIG_DRAWTEXT_FILTER)               += vf_drawtext.o
>  OBJS-$(CONFIG_ELBG_FILTER)                   += vf_elbg.o
>  OBJS-$(CONFIG_EDGEDETECT_FILTER)             += vf_edgedetect.o
> +OBJS-$(CONFIG_EQ_FILTER)                     += vf_eq.o
>  OBJS-$(CONFIG_EXTRACTPLANES_FILTER)          += vf_extractplanes.o
>  OBJS-$(CONFIG_FADE_FILTER)                   += vf_fade.o
>  OBJS-$(CONFIG_FIELD_FILTER)                  += vf_field.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 381da4f..db34cb9 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -132,6 +132,7 @@ void avfilter_register_all(void)
>      REGISTER_FILTER(DRAWTEXT,       drawtext,       vf);
>      REGISTER_FILTER(EDGEDETECT,     edgedetect,     vf);
>      REGISTER_FILTER(ELBG,           elbg,           vf);
> +    REGISTER_FILTER(EQ,             eq,             vf);
>      REGISTER_FILTER(EXTRACTPLANES,  extractplanes,  vf);
>      REGISTER_FILTER(FADE,           fade,           vf);
>      REGISTER_FILTER(FIELD,          field,          vf);
> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
> new file mode 100644
> index 0000000..494eb63
> --- /dev/null
> +++ b/libavfilter/vf_eq.c
> @@ -0,0 +1,284 @@
> +/*
> + * Original MPlayer filters by Richard Felker, Hampa Hug, Daniel Moreno,
> + * and Michael Niedermeyer.
> + *
> + * Copyright (c) 2014 James Darnley <james.darnley at gmail.com>
> + * Copyright (c) 2015 Arwa Arif <arwaarif1994 at gmail.com>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> +
> +/**
> + * @file
> + * very simple video equalizer
> + */
> +
> +/**
> + * TODO:
> + * - Add support to process_command
> + */
> +
> +#include "libavfilter/internal.h"
> +#include "libavutil/common.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "vf_eq.h"
> +#include "time.h"
> +

> +clock_t begin, end;
> +double time_spent;

Please remove this. libavutil/timer.h START_TIMER/STOP_TIMERS macros
are used to benchmark, but are not supposed to be used in committed
code, as are debug printf() calls.

[...]
> diff --git a/libavfilter/x86/Makefile b/libavfilter/x86/Makefile
> index b93154e..8222e3f 100644
> --- a/libavfilter/x86/Makefile
> +++ b/libavfilter/x86/Makefile
> @@ -1,3 +1,4 @@
> +OBJS-$(CONFIG_EQ_FILTER)                     += x86/vf_eq.o
>  OBJS-$(CONFIG_FSPP_FILTER)                   += x86/vf_fspp.o

still not updated against master

[...]
-- 
FFmpeg = Friendly and Fanciful Magical Patchable Eager Gem


More information about the ffmpeg-devel mailing list