diff options
author | Vladimir Voroshilov <voroshil@gmail.com> | 2009-06-05 10:35:11 +0700 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-24 21:11:00 +0200 |
commit | 7fadc0151c59f86769e6d189be16ead51caada84 (patch) | |
tree | bf48f57c0509a0b7194dd2da67adf643813cec1f /libavcodec/g729dec.c | |
parent | 9297c7822fc2a46472cb5bb072f9f7a7d0de2948 (diff) | |
download | ffmpeg-7fadc0151c59f86769e6d189be16ead51caada84.tar.gz |
Frame erasure support for fixed-codebook vectors
Diffstat (limited to 'libavcodec/g729dec.c')
-rw-r--r-- | libavcodec/g729dec.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 61fecd6662..c91675e63e 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -97,6 +97,7 @@ typedef struct { int16_t lsp_buf[2][10]; ///< (0.15) LSP coefficients (previous and current frames) (3.2.5) int16_t *lsp[2]; ///< pointers to lsp_buf + 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 } G729Context; @@ -224,6 +225,9 @@ static av_cold int decoder_init(AVCodecContext * avctx) ctx->lsp[1] = ctx->lsp_buf[1]; memcpy(ctx->lsp[0], lsp_init, 10 * sizeof(int16_t)); + /* random seed initialization */ + ctx->rand_value = 21845; + return 0; } @@ -336,6 +340,15 @@ 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; + if (frame_erasure) { + ctx->rand_value = g729_prng(ctx->rand_value); + fc_indexes = ctx->rand_value & ((1 << format.fc_indexes_bits) - 1); + + ctx->rand_value = g729_prng(ctx->rand_value); + pulses_signs = ctx->rand_value; + } + + memset(fc, 0, sizeof(int16_t) * SUBFRAME_SIZE); switch (packet_type) { case FORMAT_G729_8K: |