[FFmpeg-devel] [PATCH] Common ACELP code & G.729 [4/7] - G.729 core

Vladimir Voroshilov voroshil
Tue Sep 2 19:51:30 CEST 2008


2008/9/2 Michael Niedermayer <michaelni at gmx.at>:
> On Wed, Aug 27, 2008 at 03:10:48AM +0700, Vladimir Voroshilov wrote:
>> 2008/8/26 Michael Niedermayer <michaelni at gmx.at>:
>> > On Sat, Aug 23, 2008 at 08:42:02PM +0700, Vladimir Voroshilov wrote:
>> >> Updated after recent changes in SVN
>>
>>
>> >> +    int16_t gain_pitch;         ///< (1.14) pitch gain of previous subframe (3.8) [SHARP_MIN ... SHARP_MAX]
>> > [...]
>> >> +    int16_t pitch_sharp;        ///< pitch sharpening of the previous frame
>> >
>> > these 2 variables are redundant, one can be removed
>>
>> fixed
>>
>> >> +        if(ctx->frame_erasure)
>> >> +        {
>> >> +            ctx->gain_pitch = FFMIN((29491 * ctx->gain_pitch) >> 15, 29491); // 0.9 (0.15)
>> >
>> >> +            ctx->gain_code  = (8028 * ctx->gain_code) >> 13; // 0.98 in (2.13)
>> >
>> > 2007 >> 11
>>
>> fixed
> [...]
>> +typedef struct
>> +{
>> +    G729_formats format;        ///< format index from formats array
>> +    int subframe_size;          ///< number of samples produced from one subframe
>> +    int frame_erasure;          ///< frame erasure detected during decoding
>> +    int bad_pitch;              ///< parity check failed
>> +
>> +    /// past excitation signal buffer
>> +    int16_t exc_base[2*MAX_SUBFRAME_SIZE+PITCH_DELAY_MAX+INTERPOL_LEN];
>> +
>> +    int16_t* exc;               ///< start of past excitation data in buffer
>> +    int pitch_delay_int_prev;   ///< integer part of previous subframe's pitch delay (4.1.3)
>> +    int16_t lq_prev[MA_NP][10]; ///< (2.13) LSP quantizer output (3.2.4)
>> +    int16_t lsp_prev[10];       ///< (0.15) LSP coefficients from previous frame (3.2.5)
>> +    int16_t lsf_prev[10];       ///< (2.13) LSF coefficients from previous frame
>> +    int16_t quant_energy[4];    ///< (5.10) past quantized energy
>
>> +    int16_t gain_pitch;         ///< (1.14) pitch gain of previous subframe (3.8) [SHARP_MIN ... SHARP_MAX]
>
> what is the "[SHARP_MIN ... SHARP_MAX]" supposed to mean?

It was allowed range for variable.
Removed since it is not always true after joining gain_pitch and pitch_sharp

>> +
>> +            /* Decode the fixed-codebook gain. */
>> +            ctx->gain_code = ff_acelp_decode_gain_code(
>> +                    gain_corr_factor,
>> +                    fc,
>> +                    formats[ctx->format].mr_energy,
>> +                    ctx->quant_energy,
>> +                    ma_prediction_coeff,
>> +                    ctx->subframe_size,
>> +                    4);
>> +            ff_acelp_update_past_gain(ctx->quant_energy, gain_corr_factor, 2, ctx->frame_erasure);
>> +        }
>
> ff_acelp_update_past_gain can be factored out of the if/else

Splitting was done especially for moving gain_corr_factor variable
inside "if" statement.
Otherwise  one of the following is required to avoid compiler warning:

1. "=0"  before loop.
2. "=0" inside loop in frame erasure case

In both cases those fact that this variable is not used between loop
iterations is unclear
So i preferred to split the call to routine and explicitly pass zero
in frame erasure case cases.


P.S. How should i apply ok'ed chunks (since they are not standalone
parts of code)?
As in your reply, without any routine headers, if/else statements/parenthesis ?

-- 
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719




More information about the ffmpeg-devel mailing list