[FFmpeg-soc] [soc]: r4947 - amr/amrnbdec.c

cmcq subversion at mplayerhq.hu
Wed Aug 5 15:20:11 CEST 2009


Author: cmcq
Date: Wed Aug  5 15:20:11 2009
New Revision: 4947

Log:
Remove single-use variables and try to explain fixed gain prediction

Modified:
   amr/amrnbdec.c

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Wed Aug  5 14:54:25 2009	(r4946)
+++ amr/amrnbdec.c	Wed Aug  5 15:20:11 2009	(r4947)
@@ -695,15 +695,12 @@ static void pitch_sharpening(AMRContext 
 static float fixed_gain_prediction(float *fixed_vector, float *prev_pred_error,
                                    enum Mode mode)
 {
-    float energy_pred, energy_fixed_mean;
-
-    energy_pred = ff_dot_productf(energy_pred_fac, prev_pred_error, 4);
-
-    energy_fixed_mean = sqrt(ff_energyf(fixed_vector, AMR_SUBFRAME_SIZE) /
-                             AMR_SUBFRAME_SIZE);
-
-    return powf(10.0, 0.05 * (energy_pred + energy_mean[mode])) /
-        energy_fixed_mean;
+    // Equation 67: gc' = 10^0.05 (predicted dB + mean dB - dB of fixed vector)
+    return powf(10.0, 0.05 * (ff_dot_productf(energy_pred_fac, prev_pred_error,
+                                              4) + // predicted fixed energy
+                              energy_mean[mode])) /
+        // 10^(0.05 * -10log(average x^2)) = 1/sqrt((average x^2))
+        sqrt(ff_energyf(fixed_vector, AMR_SUBFRAME_SIZE) / AMR_SUBFRAME_SIZE);
 }
 
 /**


More information about the FFmpeg-soc mailing list