aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/g729dec.c
diff options
context:
space:
mode:
authorVladimir Voroshilov <voroshil@gmail.com>2008-09-03 15:55:53 +0700
committerMichael Niedermayer <michaelni@gmx.at>2011-09-24 21:11:01 +0200
commitaca516cd676f5646004c649dc614760b937f4624 (patch)
tree1f793e0a05d9d10c76c93d637d225c96f0623aaa /libavcodec/g729dec.c
parent16bbb8dfeab0d0ace5a066b7810cdf170d8739fd (diff)
downloadffmpeg-aca516cd676f5646004c649dc614760b937f4624.tar.gz
G.729 postfilter
Diffstat (limited to 'libavcodec/g729dec.c')
-rw-r--r--libavcodec/g729dec.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index b20d3d25c7..bc7fbc13a8 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -39,6 +39,7 @@
#include "acelp_pitch_delay.h"
#include "acelp_vectors.h"
#include "g729data.h"
+#include "g729postfilter.h"
/**
* minimum quantized LSF value (3.2.4)
@@ -122,6 +123,16 @@ typedef struct {
/// previous speech data for LP synthesis filter
int16_t syn_filter_data[10];
+
+ /// residual signal buffer (used in long-term postfilter)
+ int16_t residual[SUBFRAME_SIZE + RES_PREV_DATA_SIZE];
+
+ /// previous speech data for residual calculation filter
+ int16_t res_filter_data[SUBFRAME_SIZE+10];
+
+ /// previous speech data for short-term postfilter
+ int16_t pos_filter_data[SUBFRAME_SIZE+10];
+
/// (1.14) pitch gain of current and five previous subframes
int16_t past_gain_pitch[6];
@@ -133,6 +144,7 @@ typedef struct {
int16_t onset; ///< detected onset level (0-2)
int16_t was_periodic; ///< whether previous frame was declared as periodic or not (4.4)
+ int16_t ht_prev_data; ///< previous data for 4.2.3, equation 86
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
@@ -625,6 +637,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
/* Save data (without postfilter) for use in next subframe. */
memcpy(ctx->syn_filter_data, synth+SUBFRAME_SIZE, 10 * sizeof(int16_t));
+ /* Call postfilter and also update voicing decision for use in next frame. */
+ g729_postfilter(
+ &ctx->dsp,
+ &ctx->ht_prev_data,
+ &is_periodic,
+ &lp[i][0],
+ pitch_delay_int[0],
+ ctx->residual,
+ ctx->res_filter_data,
+ ctx->pos_filter_data,
+ synth+10,
+ SUBFRAME_SIZE);
+
if (frame_erasure)
ctx->pitch_delay_int_prev = FFMIN(ctx->pitch_delay_int_prev + 1, PITCH_DELAY_MAX);
else