[FFmpeg-devel] [PATCH] Move lpc utility code from flacenc.c to lpc.{c|h}

Michael Niedermayer michaelni
Fri Aug 15 11:58:26 CEST 2008


On Fri, Aug 15, 2008 at 11:44:10AM +0530, Jai Menon wrote:
> Hi,
> 
> Attached patch moves a few functions from the flac encoder so that it can be 
> shared by the alac encoder.
> 
> FWIW, 'make test' was successful.
> 
> Regards,
> 
> Jai Menon
> <realityman at gmx.net>

> Index: libavcodec/lpc.c
> ===================================================================
> --- libavcodec/lpc.c	(revision 0)
> +++ libavcodec/lpc.c	(revision 0)
> @@ -0,0 +1,117 @@
> +/**
> + * LPC utility code
> + * Copyright (c) 2006  Justin Ruggles <jruggle at earthlink.net>
> + *
> + * 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
> + */
> +
> +#include <inttypes.h>
> +#include "libavutil/avutil.h"
> +#include "lpc.h"
> +
> +/**
> + * Levinson-Durbin recursion.
> + * Produces LPC coefficients from autocorrelation data.
> + */
> +void compute_lpc_coefs(const double *autoc, int max_order,
> +                              double lpc[][MAX_LPC_ORDER], double *ref)

global functions require a ff_ prefix to avoid name clashes with other libs
when libavcodec happens to be linked to an application that also links to
various other stuff.

Also ideally there should be no fixed MAX_LPC_ORDER


[...]
> Index: libavcodec/lpc.h
> ===================================================================
> --- libavcodec/lpc.h	(revision 0)
> +++ libavcodec/lpc.h	(revision 0)
> @@ -0,0 +1,45 @@
> +/**
> + * LPC utility code
> + * Copyright (c) 2006  Justin Ruggles <jruggle at earthlink.net>
> + *
> + * 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 FFMPEG_LPC_H
> +#define FFMPEG_LPC_H
> +
> +#define MIN_LPC_ORDER       1
> +#define MAX_LPC_ORDER      32
> +

> +#define MAX_LPC_PRECISION  15
> +#define MAX_LPC_SHIFT      15

i do think they can stay where they where


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080815/12051036/attachment.pgp>



More information about the ffmpeg-devel mailing list