[FFmpeg-soc] [soc]AMR-WB decoder branch, master, updated.

Marcelo Póvoa marspeoplester at gmail.com
Wed Jul 14 01:58:22 CEST 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "AMR-WB decoder".

The branch, master has been updated
       via  0bfa12bd360d233e9caf7024f0912a4004ad8468 (commit)
       via  8410690df1a24fbf7dee5d2f0e19082f0b60367c (commit)
      from  265198b39f2332026713aa7ebcf5067a25431d52 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0bfa12bd360d233e9caf7024f0912a4004ad8468
Author: Marcelo Povoa <marspeoplester at gmail.com>
Date:   Tue Jul 13 20:55:07 2010 -0300

    Generate excitation from gain-scaled pitch and fixed vectors

diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 780d933..c20ef9c 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -710,7 +710,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
     int buf_size       = avpkt->size;
     AMRFixed fixed_sparse = {0};             // fixed vector up to anti-sparseness processing
     float fixed_gain_factor;                 // fixed gain correction factor (gamma)
-    int sub;
+    int sub, i;
     
     ctx->fr_cur_mode = unpack_bitstream(ctx, buf, buf_size);
     
@@ -760,6 +760,19 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                                        AMRWB_SUBFRAME_SIZE)/AMRWB_SUBFRAME_SIZE,
                        ctx->prediction_error,
                        ENERGY_MEAN, energy_pred_fac);
+        
+        /* Construct current excitation */
+        for (i = 0; i < AMRWB_SUBFRAME_SIZE; i++) {
+            ctx->excitation[i] *= ctx->pitch_gain[4];
+            // XXX: Did not used ff_set_fixed_vector like AMR-NB in order
+            // to retain pitch sharpening done to the fixed_vector
+            ctx->excitation[i] += ctx->fixed_gain[4] * ctx->fixed_vector[i];
+            // XXX: Should remove fractional part of excitation like NB?
+            // I did not found a reference of this in the ref decoder
+        }
+        
+        ff_clear_fixed_vector(ctx->fixed_vector, &fixed_sparse,
+                              AMRWB_SUBFRAME_SIZE);
     }
     
     // update state for next frame

commit 8410690df1a24fbf7dee5d2f0e19082f0b60367c
Author: Marcelo Povoa <marspeoplester at gmail.com>
Date:   Tue Jul 13 13:15:19 2010 -0300

    Finish calculation of the fixed gain

diff --git a/libavcodec/amrwbdata.h b/libavcodec/amrwbdata.h
index 92eed65..c52fe7a 100644
--- a/libavcodec/amrwbdata.h
+++ b/libavcodec/amrwbdata.h
@@ -25,8 +25,10 @@
 #include <stdint.h>
 
 #define LP_ORDER              16               ///< linear predictive coding filter order
-#define MIN_ISF_SPACING       50.0             /* XXX: Taken from fixed-point 26.173, not sure */
+#define MIN_ISF_SPACING       50.0             // XXX: Taken from fixed-point 26.173, not sure
 #define PRED_FACTOR           (1.0/3.0)
+#define MIN_ENERGY           -14.0             ///< initial innnovation energy (dB) 
+#define ENERGY_MEAN           30.0             ///< mean innovation energy (dB) in all modes
 
 #define AMRWB_SUBFRAME_SIZE   64               ///< samples per subframe
 #define PITCH_MAX             231              ///< maximum received pitch delay value
@@ -1746,6 +1748,9 @@ static const int16_t qua_gain_7b[128][2] = {
     { 20040,  2841},    { 21234, 19833}
 };
 
+/* 4-tap moving average prediction coefficients in reverse order */
+static const float energy_pred_fac[4] = { 0.2, 0.3, 0.4, 0.5 };
+
 /* Core frame sizes in each mode */
 static const uint16_t cf_sizes_wb[] = {
     132, 177, 253, 285, 317, 365, 397, 461, 477,
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 0530872..780d933 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -25,6 +25,7 @@
 #include "celp_math.h"
 #include "acelp_filters.h"
 #include "acelp_vectors.h"
+#include "acelp_pitch_delay.h"
 
 #include "amrwbdata.h"
 
@@ -57,6 +58,7 @@ typedef struct {
     float      pitch_vector[AMRWB_SUBFRAME_SIZE]; ///< adaptive codebook (pitch) vector for current subframe
     float      fixed_vector[AMRWB_SUBFRAME_SIZE]; ///< algebraic codebook (fixed) vector
     
+    float                    prediction_error[4]; ///< quantified prediction errors {20log10(^gamma_gc)} for previous four subframes
     float                          pitch_gain[5]; ///< quantified pitch gains for the current and previous four subframes
     float                          fixed_gain[5]; ///< quantified fixed gains for the current and previous four subframes
     
@@ -75,6 +77,11 @@ static int amrwb_decode_init(AVCodecContext *avctx)
         ctx->isp_sub4_past[i] = isp_init[i] / (float) (1 << 15);
     }
     
+    ctx->tilt_coef = 0;
+    
+    for (i = 0; i < 4; i++)
+        ctx->prediction_error[i] = MIN_ENERGY;
+    
     return 0;
 }
 
@@ -746,6 +753,13 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
                      &fixed_gain_factor, &ctx->pitch_gain[4]);
         
         pitch_sharpening(ctx, &fixed_sparse, ctx->fixed_vector);
+        
+        ctx->fixed_gain[4] =
+            ff_amr_set_fixed_gain(fixed_gain_factor,
+                       ff_dot_productf(ctx->fixed_vector, ctx->fixed_vector,
+                                       AMRWB_SUBFRAME_SIZE)/AMRWB_SUBFRAME_SIZE,
+                       ctx->prediction_error,
+                       ENERGY_MEAN, energy_pred_fac);
     }
     
     // update state for next frame

-----------------------------------------------------------------------

Summary of changes:
 libavcodec/amrwbdata.h |    7 ++++++-
 libavcodec/amrwbdec.c  |   29 ++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
AMR-WB decoder


More information about the FFmpeg-soc mailing list