[FFmpeg-cvslog] Fixed-codebook vector decoding

Vladimir Voroshilov git at videolan.org
Sat Sep 24 21:17:02 CEST 2011


ffmpeg | branch: master | Vladimir Voroshilov <voroshil at gmail.com> | Fri Jun  5 01:43:22 2009 +0700| [9297c7822fc2a46472cb5bb072f9f7a7d0de2948] | committer: Michael Niedermayer

Fixed-codebook vector decoding

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9297c7822fc2a46472cb5bb072f9f7a7d0de2948
---

 libavcodec/g729dec.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 9826e63..61fecd6 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -249,6 +249,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 
     int pitch_delay_int;         // pitch delay, integer part
     int pitch_delay_3x;          // pitch delay, multiplied by 3
+    int16_t fc[SUBFRAME_SIZE];   // fixed-codebook vector
 
     if (*data_size < SUBFRAME_SIZE << 2) {
         av_log(avctx, AV_LOG_ERROR, "Error processing packet: output buffer too small\n");
@@ -335,6 +336,28 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         /* Round pitch delay to nearest (used everywhere except ff_acelp_interpolate). */
         pitch_delay_int  = (pitch_delay_3x + 1) / 3;
 
+        memset(fc, 0, sizeof(int16_t) * SUBFRAME_SIZE);
+        switch (packet_type) {
+            case FORMAT_G729_8K:
+                ff_acelp_fc_pulse_per_track(fc, ff_fc_4pulses_8bits_tracks_13,
+                                            ff_fc_4pulses_8bits_track_4,
+                                            fc_indexes, pulses_signs, 3, 3);
+                break;
+            case FORMAT_G729D_6K4:
+                ff_acelp_fc_pulse_per_track(fc, ff_fc_2pulses_9bits_track1_gray,
+                                            ff_fc_2pulses_9bits_track2_gray,
+                                            fc_indexes, pulses_signs, 1, 4);
+                break;
+        }
+
+        /*
+          This filter enhances harmonic components of the fixed-codebook vector to
+          improve the quality of the reconstructed speech.
+
+                     / fc_v[i],                                    i < pitch_delay
+          fc_v[i] = <
+                     \ fc_v[i] + gain_pitch * fc_v[i-pitch_delay], i >= pitch_delay
+        */
         ff_acelp_weighted_vector_sum(fc + pitch_delay_int,
                                      fc + pitch_delay_int,
                                      fc, 1 << 14,



More information about the ffmpeg-cvslog mailing list