diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-26 12:37:20 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-26 12:37:20 +0100 |
commit | 8c87658fdc657fa0c19c9b507645b03d5295eb49 (patch) | |
tree | 3773185b8bb1de15485e5aef4784d38d47ff8d63 /libavcodec/gsmdec_template.c | |
parent | ac021fdc40631f77a727f076f8748f89109c785b (diff) | |
parent | a16577d9857206089fd8bce6a342b31dbd7fb9b0 (diff) | |
download | ffmpeg-8c87658fdc657fa0c19c9b507645b03d5295eb49.tar.gz |
Merge commit 'a16577d9857206089fd8bce6a342b31dbd7fb9b0'
* commit 'a16577d9857206089fd8bce6a342b31dbd7fb9b0':
MSN Audio support
Conflicts:
libavformat/riff.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/gsmdec_template.c')
-rw-r--r-- | libavcodec/gsmdec_template.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libavcodec/gsmdec_template.c b/libavcodec/gsmdec_template.c index 0f559530ec..0c60813a4a 100644 --- a/libavcodec/gsmdec_template.c +++ b/libavcodec/gsmdec_template.c @@ -28,13 +28,22 @@ #include "gsm.h" #include "gsmdec_data.h" -static void apcm_dequant_add(GetBitContext *gb, int16_t *dst) +static const int requant_tab[4][8] = { + { 0 }, + { 0, 7 }, + { 0, 2, 5, 7 }, + { 0, 1, 2, 3, 4, 5, 6, 7 } +}; + +static void apcm_dequant_add(GetBitContext *gb, int16_t *dst, const int *frame_bits) { - int i; + int i, val; int maxidx = get_bits(gb, 6); const int16_t *tab = ff_gsm_dequant_tab[maxidx]; - for (i = 0; i < 13; i++) - dst[3*i] += tab[get_bits(gb, 3)]; + for (i = 0; i < 13; i++) { + val = get_bits(gb, frame_bits[i]); + dst[3*i] += tab[requant_tab[frame_bits[i]][val]]; + } } static inline int gsm_mult(int a, int b) @@ -118,7 +127,7 @@ static int postprocess(int16_t *data, int msr) } static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples, - GetBitContext *gb) + GetBitContext *gb, int mode) { GSMContext *ctx = avctx->priv_data; int i; @@ -139,7 +148,7 @@ static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples, int offset = get_bits(gb, 2); lag = av_clip(lag, 40, 120); long_term_synth(ref_dst, lag, gain_idx); - apcm_dequant_add(gb, ref_dst + offset); + apcm_dequant_add(gb, ref_dst + offset, ff_gsm_apcm_bits[mode][i]); ref_dst += 40; } memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf)); |