[FFmpeg-soc] [soc]: r4944 - in amr: amrnbdata.h amrnbdec.c

cmcq subversion at mplayerhq.hu
Wed Aug 5 14:32:43 CEST 2009


Author: cmcq
Date: Wed Aug  5 14:32:43 2009
New Revision: 4944

Log:
Simplify energy prediction

Modified:
   amr/amrnbdata.h
   amr/amrnbdec.c

Modified: amr/amrnbdata.h
==============================================================================
--- amr/amrnbdata.h	Wed Aug  5 14:24:18 2009	(r4943)
+++ amr/amrnbdata.h	Wed Aug  5 14:32:43 2009	(r4944)
@@ -2128,8 +2128,8 @@ static const float qua_gain_code[32] = {
 /** desired mean innovation energy, indexed by active mode */
 static const float energy_mean[8] = { 33.0, 33.0, 33.0, 28.75, 30.0, 36.0, 33.0, 36.0 };
 
-/** 4-tap moving average prediction coefficients */
-static const float energy_pred_fac[4] = { 0.68, 0.58, 0.34, 0.19 };
+/** 4-tap moving average prediction coefficients in reverse order */
+static const float energy_pred_fac[4] = { 0.19, 0.34, 0.58, 0.68 };
 
 /** gain table for 4.75 kbps mode
  *

Modified: amr/amrnbdec.c
==============================================================================
--- amr/amrnbdec.c	Wed Aug  5 14:24:18 2009	(r4943)
+++ amr/amrnbdec.c	Wed Aug  5 14:32:43 2009	(r4944)
@@ -696,10 +696,9 @@ static float fixed_gain_prediction(float
                                    enum Mode mode)
 {
     int i;
-    float energy_pred = 0.0, energy_fixed_mean;
+    float energy_pred, energy_fixed_mean;
 
-    for (i = 0; i < 4; i++)
-        energy_pred += energy_pred_fac[i] * prev_pred_error[3 - i];
+    energy_pred = ff_dot_productf(energy_pred_fac, prev_pred_error, 4);
 
     energy_fixed_mean = ff_energyf(fixed_vector, AMR_SUBFRAME_SIZE);
     energy_fixed_mean = 10.0 * log10f(energy_fixed_mean / AMR_SUBFRAME_SIZE);


More information about the FFmpeg-soc mailing list