[FFmpeg-devel] [PATCH] Implement hdcd filtering

Michael Niedermayer michael at niedermayer.cc
Wed Mar 23 15:55:36 CET 2016


On Wed, Mar 23, 2016 at 12:39:30PM +0100, Benjamin St wrote:
> >
> > const?
> >
> Fixed
> 
>  missing new line.
> 
> Fixed
> 
> 
> > Here and in every other function, { must be on own, separate line like
> > in every other filter.
> >
> Fixed
> 
> Please use FFMIN()
> 
> Fixed
> 
> > +} HDCDContext;
> > > +
> > > +
> > > +static const AVOption hdcd_options[] = {
> > > +     {NULL}
> >
> > Please remove this if its not going to be used.
> >
> Isn't this needed by  AVFILTER_DEFINE_CLASS ?
> 
> This will crash if there is >2 channels
> > Either limit filter to stereo and mono or allocate this differently.
> >
> 
> Also, consider dropping the entire CHANNEL_NUM define, HDCDs will always
> > carry a stereo signal, so there's never going to be a need to change
> > CHANNEL_NUM.
> >
> Modified to only accept stereo.
> 
>  This is wrong. Either use av_calloc or modify query formats to accepts
> > only mono/stereo channel layout.
> 
> Modified to only accept stereo.
> 
>  What is hdcd? Could you put it into this long description?
> 
> Should be better know
> 
> Alphabetical order.
> 
> Fixed
> 
> This is getting into #define INCREMENT(x) (x++) territory, could you remove
> > it and just use sample *= gain everywhere?
> >
> Removed it
> 
> No need to specify exactly how many entries the array has when you define
> > it, just leave the brackets empty []. It doesn't matter that much, but it
> > makes it easier to extend the array later on if you need to.
> 
> Ok, removed it.
> 
> Duplicated ;;
> 
> Removed
> 
> 
> Thanks for review, Benjamin

>  Makefile     |    1 
>  af_hdcd.c    | 1264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  allfilters.c |    1 
>  3 files changed, 1266 insertions(+)
> 76d7406d2f7732c615981ab9c0689294a37eec72  0001-Implement-high-definition-audio-cd-filtering.patch
> From 1bc760b84592eff4bb923a23a1415f7d42a4aaf2 Mon Sep 17 00:00:00 2001
> From: Benjamin Steffes <benjaminst123 at gmail.com>
> Date: Mon, 21 Mar 2016 23:52:48 +0100
> Subject: [PATCH] Implement high definition audio cd filtering.
> 
> Signed-off-by: Benjamin Steffes <benjaminst123 at gmail.com>
> ---
>  libavfilter/Makefile     |    1 +
>  libavfilter/af_hdcd.c    | 1264 ++++++++++++++++++++++++++++++++++++++++++++++
>  libavfilter/allfilters.c |    1 +
>  3 files changed, 1266 insertions(+)
>  create mode 100644 libavfilter/af_hdcd.c
> 
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index be4b3c1..2b9bc84 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -103,6 +103,7 @@ OBJS-$(CONFIG_TREMOLO_FILTER)                += af_tremolo.o
>  OBJS-$(CONFIG_VIBRATO_FILTER)                += af_vibrato.o generate_wave_table.o
>  OBJS-$(CONFIG_VOLUME_FILTER)                 += af_volume.o
>  OBJS-$(CONFIG_VOLUMEDETECT_FILTER)           += af_volumedetect.o
> +OBJS-$(CONFIG_HDCD_FILTER)                   += af_hdcd.o
>  
>  OBJS-$(CONFIG_AEVALSRC_FILTER)               += aeval.o
>  OBJS-$(CONFIG_ANOISESRC_FILTER)              += asrc_anoisesrc.o
> diff --git a/libavfilter/af_hdcd.c b/libavfilter/af_hdcd.c
> new file mode 100644
> index 0000000..63ad309
> --- /dev/null
> +++ b/libavfilter/af_hdcd.c
> @@ -0,0 +1,1264 @@
> +/*
> +   Copyright (C) 2010, Chris Moeller,
> +   All rights reserved.
> +   Optimizations by Gumboot
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +     1. Redistributions of source code must retain the above copyright
> +        notice, this list of conditions and the following disclaimer.
> +     2. Redistributions in binary form must reproduce the above copyright
> +        notice, this list of conditions and the following disclaimer in the
> +        documentation and/or other materials provided with the distribution.
> +     3. The names of its contributors may not be used to endorse or promote
> +        products derived from this software without specific prior written
> +        permission.
> +   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> +   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
> +   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
> +   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> +   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> +   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> +   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> +   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +*/
> +
> +/*
> +  Original code reverse engineered from HDCD decoder library by Christopher Key,
> +  which was likely reverse engineered from Windows Media Player. Patents,
> +  trademarks, yadda yadda, screw it, here's the code.
> +  Rewrite and optimizations by Gumboot. Maybe the pill will be easier for others
> +  to swallow if it's C?
> +*/

this fails "make fate-source".
/tests/ref/fate/source needs to be updated or
the license changed

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160323/ce2bab4f/attachment.sig>


More information about the ffmpeg-devel mailing list