diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2013-09-07 21:06:22 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-11-26 08:31:10 +0100 |
commit | a16577d9857206089fd8bce6a342b31dbd7fb9b0 (patch) | |
tree | 45a4d07e2dddcd076bd0bf04ed2b4c65ed8e5d44 /libavcodec/gsmdec_template.c | |
parent | 56d061ce9da954560892e3551513d5ecc0439846 (diff) | |
download | ffmpeg-a16577d9857206089fd8bce6a342b31dbd7fb9b0.tar.gz |
MSN Audio support
This is essentially a MS GSM decoder extension that supports more
sampling rates and lower bitrates.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
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 b5222af4da..0b54dc54ce 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)); |