[FFmpeg-soc] [soc]: r4082 - in amr: amr-ffmpeg.diff amrnbfloatdec.c

kmalaussene subversion at mplayerhq.hu
Wed Feb 18 01:17:52 CET 2009


Author: kmalaussene
Date: Wed Feb 18 01:17:52 2009
New Revision: 4082

Log:
Reuse ff_dot_productf in fixed_gain_prediction:
avoid code duplication.

Modified:
   amr/amr-ffmpeg.diff
   amr/amrnbfloatdec.c

Modified: amr/amr-ffmpeg.diff
==============================================================================
--- amr/amr-ffmpeg.diff	Wed Feb 18 00:44:16 2009	(r4081)
+++ amr/amr-ffmpeg.diff	Wed Feb 18 01:17:52 2009	(r4082)
@@ -6,7 +6,7 @@ Index: libavcodec/Makefile
  OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
  OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
  OBJS-$(CONFIG_ALAC_ENCODER)            += alacenc.o lpc.o
-+OBJS-$(CONFIG_AMRNB_DECODER)           += amrnbfloatdec.o qcelp_lsp.o
++OBJS-$(CONFIG_AMRNB_DECODER)           += amrnbfloatdec.o qcelp_lsp.o celp_math.o
  OBJS-$(CONFIG_AMV_DECODER)             += sp5xdec.o mjpegdec.o mjpeg.o
  OBJS-$(CONFIG_APE_DECODER)             += apedec.o
  OBJS-$(CONFIG_ASV1_DECODER)            += asv1.o mpeg12data.o

Modified: amr/amrnbfloatdec.c
==============================================================================
--- amr/amrnbfloatdec.c	Wed Feb 18 00:44:16 2009	(r4081)
+++ amr/amrnbfloatdec.c	Wed Feb 18 01:17:52 2009	(r4082)
@@ -35,6 +35,7 @@
 #include "bitstream.h"
 #include "libavutil/common.h"
 #include "internal.h"
+#include "celp_math.h"
 #include "amrnbfloatdata.h"
 
 void ff_celp_lspf2lpc(const double *lspf, float *lpc);
@@ -671,7 +672,7 @@ static float fixed_gain_prediction(float
                                    enum Mode mode)
 {
     int i;
-    float energy_pred = 0.0, energy_fixed_mean = 0.0;
+    float energy_pred = 0.0, energy_fixed_mean;
 
     // Calculate the predicted energy
     for(i=0; i<4; i++) {
@@ -679,9 +680,7 @@ static float fixed_gain_prediction(float
     }
 
     // Calculate the mean fixed vector energy
-    for(i=0; i<AMR_SUBFRAME_SIZE; i++) {
-        energy_fixed_mean += fixed_vector[i]*fixed_vector[i];
-    }
+    energy_fixed_mean = ff_dot_productf(fixed_vector, fixed_vector, AMR_SUBFRAME_SIZE);
     energy_fixed_mean = 10.0*log10f(energy_fixed_mean/(float)AMR_SUBFRAME_SIZE);
 
     // predicted fixed gain =



More information about the FFmpeg-soc mailing list