diff options
author | Marcelo Galvăo Póvoa <marspeoplester@gmail.com> | 2010-09-10 19:51:08 +0000 |
---|---|---|
committer | Vitor Sessak <vitor1001@gmail.com> | 2010-09-10 19:51:08 +0000 |
commit | c7bb7eff818cb91d6f49da2fe810127ae7184758 (patch) | |
tree | 72f604ae99a669edf63b04bd1754a0cd753b5bc6 /libavcodec/amrnbdec.c | |
parent | 6f9932476dac9fde855ea84aa07bf424c5836967 (diff) | |
download | ffmpeg-c7bb7eff818cb91d6f49da2fe810127ae7184758.tar.gz |
Move AMR-NB frame unpacking code to a common file so it can be reused in
the AMR-WB decoder.
Patch by Marcelo Galvăo Póvoa.
Originally committed as revision 25100 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/amrnbdec.c')
-rw-r--r-- | libavcodec/amrnbdec.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index 616be9710e..e878019bd2 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -52,6 +52,7 @@ #include "acelp_vectors.h" #include "acelp_pitch_delay.h" #include "lsp.h" +#include "amr.h" #include "amrnbdata.h" @@ -195,24 +196,9 @@ static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf, p->bad_frame_indicator = !get_bits1(&gb); // quality bit skip_bits(&gb, 2); // two padding bits - if (mode < MODE_DTX) { - uint16_t *data = (uint16_t *)&p->frame; - const uint8_t *order = amr_unpacking_bitmaps_per_mode[mode]; - int field_size; - - memset(&p->frame, 0, sizeof(AMRNBFrame)); - buf++; - while ((field_size = *order++)) { - int field = 0; - int field_offset = *order++; - while (field_size--) { - int bit = *order++; - field <<= 1; - field |= buf[bit >> 3] >> (bit & 7) & 1; - } - data[field_offset] = field; - } - } + if (mode < MODE_DTX) + ff_amr_bit_reorder((uint16_t *) &p->frame, sizeof(AMRNBFrame), buf + 1, + amr_unpacking_bitmaps_per_mode[mode]); return mode; } |