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

Michael Niedermayer michaelni
Sat Aug 16 18:16:05 CEST 2008


On Sat, Aug 16, 2008 at 06:43:07PM +0530, Jai Menon wrote:
> Hi,
> 
> On Saturday 16 Aug 2008 5:11:26 pm Michael Niedermayer wrote:
> > On Sat, Aug 16, 2008 at 11:06:56AM +0530, Jai Menon wrote:
> > > Hi,
> > >
> > > On Saturday 16 Aug 2008 10:44:58 am Jai Menon wrote:
> > > > Hi,
> > > >
> > > > On Friday 15 Aug 2008 4:44:35 pm Michael Niedermayer wrote:
> > > > > On Fri, Aug 15, 2008 at 03:07:12PM +0530, Jai Menon wrote:
> > > > > > Hi,
> > > > > >
> > > > > > On Friday 15 Aug 2008 2:58:15 pm Ramiro Polla wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > On Fri, Aug 15, 2008 at 3:14 AM, Jai Menon <realityman at gmx.net> 
> wrote:
> > > > > > > > Attached patch moves a few functions from the flac encoder so
> > > > > > > > that it can be shared by the alac encoder.
> > > > > > >
> > > > > > > For MLP I used the entire lpc_calc_coefs(). Is that not ok for
> > > > > > > alac?
> > > > > >
> > > > > > No, currently the order estimation does not require such extensive
> > > > > > code. It doesn't really help with compression or speed. A simpler
> > > > > > approach is used instead.
> > > > >
> > > > > please also use lpc_calc_coefs()
> > > > >
> > > > > > > And the functions should be prefixed with ff_, and lpc.c be made
> > > > > > > as an svn cp ; svn diff from flacenc.c
> > > > > >
> > > > > > ...and is there any particular reason/advantage for using 'svn cp'?
> > > > > > Just curious.
> > > > >
> > > > > "svn blame" cannot relate lines of code to authors&commits if svn cp
> > > > > hasnt been used
> > > >
> > > > I made the changes and created a new patch. I used svn cp this time and
> > > > the resulting patch was quite large (to put it mildly). I wanted to
> > > > check if this is normal before posting it. It comes in at around 94kb
> > > > ;-)
> > >
> > > I'll just post it in case this is okay.
> >
> > thats fine though a little better would be to post them both ways
> > that is the files and them diffed against (the rather large) ancestors.
> >
> > That way i can see immedeatly what has changed AND how the final file
> > looks.
> >
> 
> Okay, I'll do that from now on.

thanks!


> 
> > [...]
> >
> > >   * Levinson-Durbin recursion.
> > >   * Produces LPC coefficients from autocorrelation data.
> > >   */
> > > -static void compute_lpc_coefs(const double *autoc, int max_order,
> > > -                              double lpc[][MAX_LPC_ORDER], double *ref)
> > > -{
> > > -   int i, j, i2;
> > > -   double r, err, tmp;
> > > -   double lpc_tmp[MAX_LPC_ORDER];
> > > +void ff_compute_lpc_coefs(const double *autoc, int max_order,
> > > +                          double lpc[][MAX_LPC_ORDER], double *ref);
> >
> > [..]
> >
> > >  /**
> > >   * Quantize LPC coefficients
> > >   */
> > > -static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
> > > -                               int32_t *lpc_out, int *shift)
> > > -{
> > > -    int i;
> > > -    double cmax, error;
> > > -    int32_t qmax;
> > > -    int sh;
> > > +void ff_quantize_lpc_coefs(double *lpc_in, int order, int precision,
> > > +                           int32_t *lpc_out, int *shift, int max_shift,
> > > int zero_shift);
> >
> > These functions should stay static, they contain specific implementations
> > that can be access through lpc_calc_coefs()
> >
> 
> That was intentional, I was thinking that if somebody wanted to use the 
> functions in a weird manner different from lpc_calc_coefs, they should be 
> able to.
> Anyhow, changes made and new diff+separate files attached.
> 
> Oh, and forgot to mention, 'make test' was successful.
[...]
>   * Levinson-Durbin recursion.
>   * Produces LPC coefficients from autocorrelation data.
>   */
> -static void compute_lpc_coefs(const double *autoc, int max_order,
> -                              double lpc[][MAX_LPC_ORDER], double *ref)
> +static void ff_compute_lpc_coefs(const double *autoc, int max_order,
> +                          double lpc[][MAX_LPC_ORDER], double *ref)
>  {
>     int i, j, i2;
>     double r, err, tmp;
> @@ -679,8 +68,8 @@
>  /**
>   * Quantize LPC coefficients
>   */
> -static void quantize_lpc_coefs(double *lpc_in, int order, int precision,
> -                               int32_t *lpc_out, int *shift)
> +static void ff_quantize_lpc_coefs(double *lpc_in, int order, int precision,
> +                           int32_t *lpc_out, int *shift, int max_shift, int zero_shift)
>  {
>      int i;
>      double cmax, error;


the renaming is unneeded as the functions are still static
except that iam ok with the patch


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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- 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/20080816/af459272/attachment.pgp>



More information about the ffmpeg-devel mailing list