[FFmpeg-devel] [PATCH] Common ACELP code & G.729 [7/7] - G.729D decoder

Michael Niedermayer michaelni
Wed May 7 20:49:40 CEST 2008


On Fri, May 02, 2008 at 09:30:22PM +0700, Vladimir Voroshilov wrote:
> On Fri, May 2, 2008 at 9:16 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Fri, May 02, 2008 at 06:51:07PM +0700, Vladimir Voroshilov wrote:
> >  > Patch adds support for G.729D and intended to apply
> >  > only after accepting and committing G.729.
> >
> >  Hum the size of this patch scares me ...
> 
> :)
> 
> Here is it
[...]
> +/**
> + * \brief construct new excitation signal with phase filter applied
> + * \param out[out] (Q0) constructed speech signal
> + * \param in (Q0) original excitation signal
> + * \param fc_cur (Q13) original fixed codebook vector
> + * \param gain_code (Q1) gain code
> + * \param subframe_size length of the subframe
> + */
> +void g729d_get_new_exc(
> +        int16_t* out,
> +        const int16_t* in,
> +        const int16_t* fc_cur,
> +        int dstate,
> +        int gain_code,
> +        int subframe_size)
> +{
> +    int i;
> +    int16_t fc_new[MAX_SUBFRAME_SIZE];
> +

> +    ff_acelp_convolve_circ(fc_new, fc_cur, ff_g729_phase_filter[dstate], subframe_size);

if dstate == 2 then this does pretty much nothing and can be skiped


> +
> +    for(i=0; i<subframe_size; i++)
> +    {
> +        out[i]  = in[i];

> +        out[i] -= (gain_code * fc_cur[i] + 0x2000) >> 14;
> +        out[i] += (gain_code * fc_new[i] + 0x2000) >> 14;

out[i] += (gain_code * (fc_new[i] - fc_cur[i]) + 0x2000) >> 14;


[...]
>              /* 4.4.2, Equation 94 */
> -            ctx->gain_pitch = FFMIN((29491 * ctx->gain_pitch) >> 15, 29491); // 0.9 (Q15)
> +            ctx->past_gain_pitch[0] = FFMIN((29491 * ctx->past_gain_pitch[0]) >> 15, 29491); // 0.9 (Q15)
>  
>              /* 4.4.2, Equation 93 */
> -            ctx->gain_code  = (8028 * ctx->gain_code) >> 13; // 0.98 in Q13
> +            ctx->past_gain_code[0]  = (8028 * ctx->past_gain_code[0]) >> 13; // 0.98 in Q13

These could be in a seperate patch or even included from the begin

[...]
> @@ -652,7 +802,6 @@ static int  g729_decode_frame_internal(
>                      11,
>                      0);
>          }
> -
>          // Save data (without postfilter) for using in next subframe
>          memcpy(ctx->syn_filter_data, ctx->syn_filter_data+ctx->subframe_size, 10 * sizeof(int16_t));

hmm


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20080507/837d4b1a/attachment.pgp>



More information about the ffmpeg-devel mailing list