[FFmpeg-devel] [PATCH] Common ACELP routines - pitch lag decoding
Michael Niedermayer
michaelni
Mon Apr 28 01:33:27 CEST 2008
On Sun, Apr 27, 2008 at 07:08:10PM +0700, Vladimir Voroshilov wrote:
> On Sun, Apr 27, 2008 at 6:41 PM, Diego Biurrun <diego at biurrun.de> wrote:
> > On Sun, Apr 27, 2008 at 06:11:50PM +0700, Vladimir Voroshilov wrote:
> > >
> > > Here is another small set of routines which can be shared between
> > > AMR (even with floating point) and G.729.
> > >
> > > --- /dev/null
> > > +++ b/libavcodec/acelp_pitch_lag.h
> > > @@ -0,0 +1,175 @@
> > > + *
> > > + * From G.729 psecification:
> >
> > specification
>
> Fixed.
>
> > > + * This range is adapted for the cases where T1 straddles the boundaries of the
> > > + * delay range [20; 143].
> >
> > What do you mean by "straddles" here?
>
> This is exact phrase from specification.
> I read it as "This range is adapted to completely fit into delay range
> [20; 143]"
>
> >
> > > + * \param subframeno subframe number (0 - 1st,3rd subframes; 1 - 2nd,4th subframes)
> >
> > Add spaces after the commas please.
>
> Done
[...]
> +void ff_acelp_decode_lag3_8_4_bits(
> + int* pitch_lag_int,
> + int* pitch_lag_frac,
> + int ac_index,
> + int subframeno,
> + int pitch_lag_min)
> +{
> + // (4.1.3 of G.729 and 5.6.1 of AMR)
> + if (!subframeno)
> + {
> + if(ac_index < 197)
> + {
> + *pitch_lag_frac = (ac_index + 2)%3 - 1;
> + *pitch_lag_int = (ac_index + 2)/3 + 19;
> + }
> + else
> + {
> + *pitch_lag_int = ac_index - 112;
> + *pitch_lag_frac = 0;
> + }
> + }
> + else
> + {
> + ac_index &= 0xf;
> +
> + if(ac_index < 4)
> + {
> + *pitch_lag_frac = 0;
> + *pitch_lag_int = ac_index;
> + }
> + else if(ac_index < 12)
> + {
> + *pitch_lag_frac = (ac_index + 1)%3 - 1;
> + *pitch_lag_int = (ac_index + 1)/3 + 2;
> + }
> + else
> + {
> + *pitch_lag_frac = 0;
> + *pitch_lag_int = ac_index - 6;
> + }
> +
> + *pitch_lag_int += pitch_lag_min;
> + }
> +}
Is this simpler if the frac/int split is factored out?
If (and only if) its simpler then please split it out. That is have the
%3 /3 at the end outside all if/else
> +
> +void ff_acelp_decode_lag3_8_56_bits(
> + int* pitch_lag_int,
> + int* pitch_lag_frac,
> + int ac_index,
> + int subframeno,
> + int pitch_lag_min)
> +{
> + // (4.1.3 of G.729 and 5.6.1 of AMR)
> + if (!subframeno)
> + {
> + if(ac_index < 197)
> + {
> + *pitch_lag_frac = (ac_index + 2)%3 - 1;
> + *pitch_lag_int = (ac_index + 2)/3 + 19;
> + }
> + else
> + {
> + *pitch_lag_int = ac_index - 112;
> + *pitch_lag_frac = 0;
> + }
> + }
duplicate
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- 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/20080428/16ff929f/attachment.pgp>
More information about the ffmpeg-devel
mailing list