aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/g729dec.c
diff options
context:
space:
mode:
authorVladimir Voroshilov <voroshil@gmail.com>2009-06-05 02:05:57 +0700
committerMichael Niedermayer <michaelni@gmx.at>2011-09-24 21:11:00 +0200
commitc458bff934c1ab50ce629b4f4e26626e6f037aca (patch)
tree07feb0d6227d6a401833b8b109ca654d8e5eb834 /libavcodec/g729dec.c
parente610c5f383f31e55a672961f1e671d83328c36b1 (diff)
downloadffmpeg-c458bff934c1ab50ce629b4f4e26626e6f037aca.tar.gz
High-pass filter
Diffstat (limited to 'libavcodec/g729dec.c')
-rw-r--r--libavcodec/g729dec.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 5fc2167277..e1d4df9b43 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;