[FFmpeg-devel] port mplayer eq filter to libavfilter
William Yu
genwillyu
Tue Nov 23 10:18:08 CET 2010
I can't found original author contact info from mplayer's files. so i
not sure weather original author relicense it under LGPL.
2010/11/23 Aurelien Jacobs <aurel at gnuage.org>:
> On Mon, Nov 22, 2010 at 08:33:11PM +0800, William Yu wrote:
>> I port mplayer's libmpcodec/vf_eq.c to libavfilter. May be some other
>> people need it to adjust video's brightness and contrast
>>
>> [...]
>> diff --git a/configure b/configure
>> index 7dcb50f..f599cec 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1408,6 +1408,7 @@ cropdetect_filter_deps="gpl"
>> ?frei0r_filter_deps="frei0r dlopen strtok_r"
>> ?ocv_smooth_filter_deps="libopencv"
>> ?yadif_filter_deps="gpl"
>> +eq_filter_deps="gpl"
>
> Did the original author refused to relicense under LGPL ?
I can't found original author contact info from mplayer's files. so i
am not sure whether original author would like to relicense it under
LGPL. Has any one can tell me about it?
>> [...]
>> diff --git a/libavfilter/eq.h b/libavfilter/eq.h
>> new file mode 100644
>> index 0000000..7084e5c
>> --- /dev/null
>> +++ b/libavfilter/eq.h
>> @@ -0,0 +1,34 @@
>> +/*
>> + * Ported to FFmpeg from MPlayer libmpcodecs/vf_eq.c
>> + * Port copyright (C) 2010 William Yu <genwillyu at gmail dot 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 Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 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
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser 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
>> + */
>> +
>> +#ifndef AVFILTER_EQ_H
>> +#define AVFILTER_EQ_H
>> +
>> +#include "avfilter.h"
>> +
>> +#if HAVE_MMX
>
> This #if shouldn't be needed.
I think add this #if can reduce code when some people config it for
NOT use MMX, another side i think this can help compile it under other
arch. Is this correct?
>
>> +void ff_eq_filter_process_mmx(uint8_t *dest,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int dstride, uint8_t *src, int sstride,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int w, int h, int brightness,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?int contrast);
>> +#endif /* HAVE_MMX */
>> +
>> +#endif /* AVFILTER_EQ_H */
>> diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
>> new file mode 100644
>> index 0000000..0c25a8e
>> --- /dev/null
>> +++ b/libavfilter/vf_eq.c
>> @@ -0,0 +1,181 @@
>> +/*
>> + * Ported to FFmpeg from MPlayer libmpcodecs/vf_eq.c
>> + * Port copyright (C) 2010 William Yu <genwillyu at gmail dot com>
>
> You should keep the original copyright lines.
I can not see any original copyright lines on original mplayer's
libmpcodec/vf_eq.c.
But I see mplayer's file MAINTAINERS include this line:
"* all filters written by Michael Niedermayer - Michael Niedermayer"
May i add Michael Niedermayer to original author?
May be i should ask Michael Niedermayer whether he would like to
relicense it under LGPL?
>
>> [...]
>> +static av_cold int init(AVFilterContext *ctx, const char * args, void * opaque)
>> +{
>> + ? ?EQContext * eq = ctx->priv;
>> + ? ?av_unused int cpu_flags = av_get_cpu_flags();
>> +
>> + ? ?eq->brightness = 0;
>> + ? ?eq->contrast = 0;
>> +
>> + ? ?if (args)
>> + ? ? ? ?sscanf(args, "%d:%d", &(eq->brightness), &(eq->contrast));
>> +
>> + ? ?if (eq->brightness < -100 || eq->brightness > 100 ||
>> + ? ? ? ?eq->contrast < -100 || eq->contrast > 100) {
>> + ? ? ? ?av_log(ctx, AV_LOG_ERROR,
>> + ? ? ? ? ? ? ? ?"Invalid brightness or contrast value %d:%d\n",
>> + ? ? ? ? ? ? ? ?eq->brightness, eq->contrast);
>> + ? ? ? ?return AVERROR(EINVAL);
>> + ? ?}
>> +
>> + ? ?av_log(ctx, AV_LOG_INFO,
>> + ? ? ? ?"brightness and contrast value %d:%d\n",
>> + ? ? ? ?eq->brightness, eq->contrast);
>> + ? ?eq->process = process_c;
>> +#if HAVE_MMX
>> + ? ?if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) {
>> + ? ? ? ?av_log(ctx,AV_LOG_INFO,"use mmx\n");
>> + ? ? ? ?eq->process = ff_eq_filter_process_mmx;
>> + ? ?}
>> +#endif
>
> And here again, the #if could be removed.
I think if we config HAVE_MMX to 0, we need not compile these code.
>
> Aurel
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list