# [FFmpeg-devel] [PATCH] Common ACELP code & G.729 [1/7] - filters

Vladimir Voroshilov voroshil
Tue May 6 18:24:38 CEST 2008

On Mon, May 5, 2008 at 3:42 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, May 04, 2008 at 01:19:10PM +0700, Vladimir Voroshilov wrote:
>  > On Sat, May 3, 2008 at 7:23 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>  > > On Sat, May 03, 2008 at 03:24:54PM +0700, Vladimir Voroshilov wrote:
>  > >  > Michael Niedermayer wrote:
>  > >  [...]
>  > >  > +void ff_acelp_convolve_circ(
>  > >  > +        int16_t* fc_out,
>  > >  > +        const int16_t* fc_in,
>  > >  > +        const int16_t* filter,
>  > >  > +        int subframe_size)
>  > >  > +{
>  > >  > +    int i, k;
>  > >  > +
>  > >  > +    memset(fc_out, 0, subframe_size * sizeof(int16_t));
>  > >
>  > > > +
>  > >  > +    /* Since there are few pulses over all subframe (i.e. almost all
>  > >
>  > > > +       fc_in[i] are zero, in case of G.729D it is only two non-zero
>  > >  > +       samples of total 40), it is faster to swap two loops and process
>  > >  > +       non-zero samples only. This will reduce number of multiplications
>  > >
>  > > > +       from 40*40 to 2*40 for G.729D */
>  > >
>  > >  doesnt ff_acelp_fc_enchance_harmonics() increase the number of non 0
>  > >  elements above 2 ?
>  >
>  > Perhaps i misspelled sentence.
>  > I meant that using swapped loops with checking for non-zero will
>  > require 2*40 multiplications,
>
>  The sentance is fine.
>  What i meant is that ff_acelp_fc_enchance_harmonics() can increase the number
>  of non zero samples above 2. Or do i miss somehing that prevents this?

This is exactly what this filter intended to do.
It get buffer with few pulses and smooth them over all subframe.
In reference code it is caller "pitch_shrp" ("pitch sharpening" i guess).

>
>
>
>  > while using not swapped loops without check will require 40*40 multiplications.
>  > 2*40 is exact in case when "in" and "out" are different buffers (and
>  > this is required!)
>  > since "in" buffer is not touched in loop
>  >
>  > I'll be thankful for correct and clean english phrase.
>  >
>  > [...]
>  >
>  > >  > + */
>  > >  > +void ff_acelp_weighted_filter(
>  > >  > +        int16_t *out,
>  > >  > +        const int16_t* in,
>  > >  > +        const int16_t *weight_pow,
>  > >  > +        int filter_length);
>  > >
>  > >  > +
>  > >  > +/**
>  > >  > + * \brief high-pass filtering and upscaling (4.2.5 of G.729)
>  > >
>  > >  just G729 ? or is it also used by others?
>  >
>  > AMR (according to spec) uses mostly same filter (same formula, but
>  > filter coefficients differs in 5th sign).
>  > In fixed-point implementation all filter coefficients are equal.
>  > I'll add clarification in next update.
>
>  ok

I've made a try :)
See patch.

--
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: 01_acelp_filt_42.diff
Type: text/x-diff
Size: 8176 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080506/15d07461/attachment.diff>

More information about the ffmpeg-devel mailing list