[FFmpeg-devel] [PATCH] Common ACELP code & G.729 [3/7] - vectors operations
Vladimir Voroshilov
voroshil
Thu May 22 17:27:13 CEST 2008
2008/5/22, Michael Niedermayer <michaelni at gmx.at>:
> On Thu, May 22, 2008 at 05:50:28PM +0700, Vladimir Voroshilov wrote:
[...]
> > >> +void ff_acelp_fc_enchance_harmonics(
> > >> + int16_t* fc_v,
> > >> + int pitch_delay,
> > >> + int16_t gain_pitch,
> > >> + int length)
> > >> +{
> > >> + int i;
> > >> +
> > >> + for(i=pitch_delay; i<length;i++)
> > >> + fc_v[i] += (fc_v[i - pitch_delay] * gain_pitch) >> 14;
> > >> +}
> > >> +
> > >> +void ff_acelp_build_excitation(
> > >> + int16_t* exc,
> > >> + const int16_t *ac_v,
> > >> + const int16_t *fc_v,
> > >> + int16_t gp,
> > >> + int16_t gc,
> > >> + int subframe_size)
> > >> +{
> > >> + int i;
> > >> +
> > >> + // Clipping required here; breaks OVERFLOW test.
> > >> + for(i=0; i<subframe_size; i++)
> > >> + exc[i] = av_clip_int16((ac_v[i] * gp + fc_v[i] * gc + 0x2000) >> 14);
> > >> +}
> > >
> > > duplicate, these 2 functions do the same, that is a wheighted sum of 2
> > > vectors.
> > >
> >
> > agree.
> > As i see
> >
> > ff_acelp_fc_enchance_harmonics(fc_v, pitch_delay, gain_pitch, length)
> >
> > is equal to
> >
> > ff_acelp_build_excitation(fc_v+pitch_delay, fc_v+pitch_delay,
> > fc,1<<14, gain_pitch, length-pitch_delay);
> >
> > but what should i do with rounding ?
> >
> > what about adding additional parameter (const summand) to
> > ff_acelp_build_excitation
> > I.e. something like:
> >
> > void ff_acelp_build_excitation(
> > int16_t* exc,
> > const int16_t *ac_v,
> > const int16_t *fc_v,
> > int16_t gp,
> > int16_t gc,
> > int16_t summand,
> > int subframe_size)
> > {
> > int i;
> >
> > // Clipping required here; breaks OVERFLOW test.
> > for(i=0; i<subframe_size; i++)
> > exc[i] = av_clip_int16((ac_v[i] * gp + fc_v[i] * gc + summand) >> 14);
> > }
> >
> > What about renaming ff_acelp_build_excitation like ff_acelp_weighted_vector_sum
> > (and subframe_size -> length, ac_v -> vect_a, fc_v -> vect_b, gc ->
> > weight_coeff_a, gp -> weight_coeff_b)?
>
>
> ok
>
>
>
> >
> > P.S. "summand" don't look like the best name too.
>
>
> maybe offset or rounder are better?
>
here is the patch.
I have also added "shift" parameter.
This will simplify reusing from g729 postfilter (since it
uses vectors with different fixed-point base).
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03_acelp_vectors54.diff
Type: text/x-diff
Size: 9355 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080522/0711ac50/attachment.diff>
More information about the ffmpeg-devel
mailing list