[FFmpeg-devel] [PATCH] Common ACELP code & G.729 [3/7] - vectors operations
Michael Niedermayer
michaelni
Thu May 22 19:11:18 CEST 2008
On Thu, May 22, 2008 at 10:27:13PM +0700, Vladimir Voroshilov wrote:
> 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).
[...]
> +void ff_acelp_fc_pulse_per_track(
id call it ff_acelp_decode_fixed_codebook_vector())
> + int16_t* fc_v,
> + const uint8_t *tab1,
> + const uint8_t *tab2,
> + int fc_index,
pulses_indices seems to fit better with pulses_signs
also i think it should be pulse_signs / indices not pulses
except these patch ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- 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/20080522/fbb5a0b2/attachment.pgp>
More information about the ffmpeg-devel
mailing list