[FFmpeg-soc] [soc]: r4168 - amr/amrnbfloatdec.c

kmalaussene subversion at mplayerhq.hu
Wed Mar 4 23:59:24 CET 2009


Author: kmalaussene
Date: Wed Mar  4 23:59:24 2009
New Revision: 4168

Log:
The hangover period (diff > 0.65) must be updated for every mode,
not just the ones for which the fixed gain is smoothed.

See 3GPP TS 26.090 eq 71.

Modified:
   amr/amrnbfloatdec.c

Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c	Wed Mar  4 22:44:08 2009	(r4167)
+++ amr/amrnbfloatdec.c	Wed Mar  4 23:59:24 2009	(r4168)
@@ -694,7 +694,8 @@ static float fixed_gain_prediction(float
  * @return fixed gain smoothed
  */
 
-static float fixed_gain_smooth(AMRContext *p , const float *lsp, const float *lsp_avg) {
+static float fixed_gain_smooth(AMRContext *p , const float *lsp, const float *lsp_avg
+                               const enum Mode mode) {
     float diff             = 0.0;
     int   i;
 
@@ -704,7 +705,8 @@ static float fixed_gain_smooth(AMRContex
     }
 
     // if diff has been >0.65 for 10 frames (40 subframes) no smoothing is applied
-    if((p->diff_count = diff > 0.65 ? p->diff_count+1 : 0) < 40) {
+    if((p->diff_count = diff > 0.65 ? p->diff_count+1 : 0) < 40 &&
+       (mode < MODE_74 || mode == MODE_102)) {
         // calculate the fixed gain smoothing factor (k_m)
         const float smoothing_factor = FFMIN(1.0, FFMAX(0.0, 4.0*diff - 1.6));
         // calculate the mean fixed gain for the current subframe
@@ -971,8 +973,7 @@ static int amrnb_decode_frame(AVCodecCon
         }
 
         // smooth fixed gain
-        if(p->cur_frame_mode < MODE_74 || p->cur_frame_mode == MODE_102)
-            p->fixed_gain[4] = fixed_gain_smooth(p, p->lsp[subframe], p->lsp_avg);
+        p->fixed_gain[4] = fixed_gain_smooth(p, p->lsp[subframe], p->lsp_avg, p->cur_frame_mode);
 
         apply_ir_filter(p, p->fixed_vector);
 



More information about the FFmpeg-soc mailing list