summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandra Hájková <alexandra@khirnov.net>2016-04-07 21:38:52 +0200
committerAnton Khirnov <anton@khirnov.net>2016-09-30 19:14:32 +0200
commit9648688f9c2980a91dafa26d64d17f4cf0ac75a7 (patch)
tree01909a5bd27f8f93240447c08ec15dd7ebff028a
parentedac0f723f1b5734e5235e88e22358b84406624a (diff)
adpcm: Convert to the new bitstream header
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavcodec/adpcm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 3ab16dd0b4..fe51c0d008 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -29,8 +29,9 @@
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
#include "put_bits.h"
#include "bytestream.h"
#include "adpcm.h"
@@ -366,32 +367,33 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples)
{
ADPCMDecodeContext *c = avctx->priv_data;
- GetBitContext gb;
+ BitstreamContext bc;
const int *table;
int k0, signmask, nb_bits, count;
int size = buf_size*8;
int i;
- init_get_bits(&gb, buf, size);
+ bitstream_init(&bc, buf, size);
//read bits & initial values
- nb_bits = get_bits(&gb, 2)+2;
+ nb_bits = bitstream_read(&bc, 2)+2;
table = swf_index_tables[nb_bits-2];
k0 = 1 << (nb_bits-2);
signmask = 1 << (nb_bits-1);
- while (get_bits_count(&gb) <= size - 22*avctx->channels) {
+ while (bitstream_tell(&bc) <= size - 22 * avctx->channels) {
for (i = 0; i < avctx->channels; i++) {
- *samples++ = c->status[i].predictor = get_sbits(&gb, 16);
- c->status[i].step_index = get_bits(&gb, 6);
+ *samples++ =
+ c->status[i].predictor = bitstream_read_signed(&bc, 16);
+ c->status[i].step_index = bitstream_read(&bc, 6);
}
- for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
+ for (count = 0; bitstream_tell(&bc) <= size - nb_bits * avctx->channels && count < 4095; count++) {
int i;
for (i = 0; i < avctx->channels; i++) {
// similar to IMA adpcm
- int delta = get_bits(&gb, nb_bits);
+ int delta = bitstream_read(&bc, nb_bits);
int step = ff_adpcm_step_table[c->status[i].step_index];
long vpdiff = 0; // vpdiff = (delta+0.5)*step/4
int k = k0;