[FFmpeg-cvslog] High-pass filter

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


ffmpeg | branch: master | Vladimir Voroshilov <voroshil at gmail.com> | Fri Jun  5 02:05:57 2009 +0700| [c458bff934c1ab50ce629b4f4e26626e6f037aca] | committer: Michael Niedermayer

High-pass filter

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

 libavcodec/g729dec.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 5fc2167..e1d4df9 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -135,6 +135,12 @@ typedef struct {
     int16_t was_periodic;       ///< whether previous frame was declared as periodic or not (4.4)
     uint16_t rand_value;        ///< random number generator value (4.4.4)
     int ma_predictor_prev;      ///< switched MA predictor of LSP quantizer from last good frame
+
+    /// (14.14) high-pass filter data (past input)
+    int hpf_f[2];
+
+    /// high-pass filter data (past output)
+    int16_t hpf_z[2];
 }  G729Context;
 
 static const G729FormatDescription format_g729_8k = {
@@ -577,9 +583,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 
         memcpy(synth, ctx->syn_filter_data, 10 * sizeof(int16_t));
 
-        /* Temporary synth buffer is required since filter needs additional space at top of buffer and, thus,
-           synthesis can not be done directly to output buffer. This buffer will be reused by future
-           postprocessing filters. */
         if (ff_celp_lp_synthesis_filter(
             synth+10,
             &lp[i][1],
@@ -627,8 +630,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         else
             ctx->pitch_delay_int_prev = pitch_delay_int;
 
-        /* Dumb. Will be replaced by high-pass filter */
-        memcpy(out_frame + i * SUBFRAME_SIZE, synth + 10, SUBFRAME_SIZE * sizeof(int16_t));
+        memcpy(synth+8, ctx->hpf_z, 2*sizeof(int16_t));
+        ff_acelp_high_pass_filter(
+                out_frame + i*SUBFRAME_SIZE,
+                ctx->hpf_f,
+                synth+10,
+                SUBFRAME_SIZE);
+        memcpy(ctx->hpf_z, synth+8+SUBFRAME_SIZE, 2*sizeof(int16_t));
     }
 
     ctx->was_periodic = is_periodic;



More information about the ffmpeg-cvslog mailing list