summaryrefslogtreecommitdiff
path: root/libavcodec/g729dec.c
diff options
context:
space:
mode:
authorVladimir Voroshilov <voroshil@gmail.com>2009-06-11 13:51:28 +0700
committerMichael Niedermayer <michaelni@gmx.at>2011-09-24 21:11:00 +0200
commit50cad2562522142f15ef0370df07939652c9feb3 (patch)
treeb451516f8309d8d34ab64d3a1ad3b8a7585f9e19 /libavcodec/g729dec.c
parentd1a643e749f7b4495f0c4fabf9177f730fbd5574 (diff)
Frame erasure support for pitch delay decoding
Diffstat (limited to 'libavcodec/g729dec.c')
-rw-r--r--libavcodec/g729dec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c
index 42783d61fb..1e29a7e9a2 100644
--- a/libavcodec/g729dec.c
+++ b/libavcodec/g729dec.c
@@ -306,7 +306,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
gc_1st_index = get_bits(&gb, format.gc_1st_index_bits);
gc_2nd_index = get_bits(&gb, format.gc_2nd_index_bits);
- if(!i) {
+ if (frame_erasure)
+ pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
+ else if(!i) {
if (bad_pitch)
pitch_delay_3x = 3 * ctx->pitch_delay_int_prev;
else
@@ -348,6 +350,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
( voicing && frame_erasure) ? 0 : ctx->gain_code,
1 << 13, 14, SUBFRAME_SIZE);
+ if (frame_erasure)
+ ctx->pitch_delay_int_prev = FFMIN(ctx->pitch_delay_int_prev + 1, PITCH_DELAY_MAX);
+ else
ctx->pitch_delay_int_prev = pitch_delay_int;
}