aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-06-06 13:20:17 +0200
committerDiego Biurrun <diego@biurrun.de>2017-02-07 18:27:21 +0100
commita25dac976a4478331e4db86d44c3db4456c93eff (patch)
treebe0638f8ebcb9e00dfdad10a73d0fc5ccee03293
parent71a49fe25f2e4468fbbadbebef8d073b1b3cc1a5 (diff)
downloadffmpeg-a25dac976a4478331e4db86d44c3db4456c93eff.tar.gz
Use bitstream_init8() where appropriate
-rw-r--r--libavcodec/4xm.c6
-rw-r--r--libavcodec/adxdec.c2
-rw-r--r--libavcodec/asvdec.c2
-rw-r--r--libavcodec/atrac1.c2
-rw-r--r--libavcodec/atrac3.c10
-rw-r--r--libavcodec/avs.c2
-rw-r--r--libavcodec/cdxl.c4
-rw-r--r--libavcodec/cljrdec.c2
-rw-r--r--libavcodec/dss_sp.c2
-rw-r--r--libavcodec/dvbsubdec.c4
-rw-r--r--libavcodec/eatgq.c2
-rw-r--r--libavcodec/eatgv.c2
-rw-r--r--libavcodec/escape124.c2
-rw-r--r--libavcodec/escape130.c2
-rw-r--r--libavcodec/faxcompr.c2
-rw-r--r--libavcodec/flashsv.c2
-rw-r--r--libavcodec/fraps.c2
-rw-r--r--libavcodec/g2meet.c4
-rw-r--r--libavcodec/g722dec.c2
-rw-r--r--libavcodec/g723_1dec.c2
-rw-r--r--libavcodec/g726.c2
-rw-r--r--libavcodec/gsmdec.c2
-rw-r--r--libavcodec/hq_hqa.c8
-rw-r--r--libavcodec/imc.c2
-rw-r--r--libavcodec/indeo2.c2
-rw-r--r--libavcodec/indeo3.c2
-rw-r--r--libavcodec/interplayvideo.c2
-rw-r--r--libavcodec/ivi.c2
-rw-r--r--libavcodec/jvdec.c2
-rw-r--r--libavcodec/lagarith.c2
-rw-r--r--libavcodec/metasound.c2
-rw-r--r--libavcodec/mimic.c2
-rw-r--r--libavcodec/mlp_parser.c2
-rw-r--r--libavcodec/mlpdec.c4
-rw-r--r--libavcodec/motionpixels.c2
-rw-r--r--libavcodec/mpc7.c2
-rw-r--r--libavcodec/mpc8.c2
-rw-r--r--libavcodec/msgsmdec.c2
-rw-r--r--libavcodec/nellymoserdec.c4
-rw-r--r--libavcodec/pcx.c2
-rw-r--r--libavcodec/qcelpdec.c2
-rw-r--r--libavcodec/qdm2.c12
-rw-r--r--libavcodec/ra144dec.c2
-rw-r--r--libavcodec/ra288.c2
-rw-r--r--libavcodec/smacker.c6
-rw-r--r--libavcodec/svq1dec.c4
-rw-r--r--libavcodec/tiertexseqv.c6
-rw-r--r--libavcodec/truemotion2.c6
-rw-r--r--libavcodec/truespeech.c2
-rw-r--r--libavcodec/tscc2.c2
-rw-r--r--libavcodec/tta.c4
-rw-r--r--libavcodec/twinvqdec.c2
-rw-r--r--libavcodec/utvideodec.c2
-rw-r--r--libavcodec/vble.c2
-rw-r--r--libavcodec/webp.c4
-rw-r--r--libavcodec/wnv1.c2
-rw-r--r--libavcodec/xan.c2
-rw-r--r--libavcodec/xsubdec.c2
-rw-r--r--libavformat/h261dec.c2
-rw-r--r--libavformat/mov.c2
-rw-r--r--libavformat/movenc.c4
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/oggparseflac.c2
-rw-r--r--libavformat/oggparsetheora.c2
-rw-r--r--libavformat/rdt.c2
-rw-r--r--libavformat/rtpdec_latm.c2
-rw-r--r--libavformat/rtpdec_mpeg4.c2
-rw-r--r--libavformat/rtpdec_qt.c2
-rw-r--r--libavformat/rtpenc_h263_rfc2190.c2
69 files changed, 98 insertions, 98 deletions
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index ee9d0205d5..28f839165e 100644
--- a/libavcodec/4xm.c
+++ b/libavcodec/4xm.c
@@ -454,7 +454,7 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
bitstream_size / 4);
memset((uint8_t*)f->bitstream_buffer + bitstream_size,
0, AV_INPUT_BUFFER_PADDING_SIZE);
- bitstream_init(&f->bc, f->bitstream_buffer, 8 * bitstream_size);
+ bitstream_init8(&f->bc, f->bitstream_buffer, bitstream_size);
wordstream_offset = extra + bitstream_size;
bytestream_offset = extra + bitstream_size + wordstream_size;
@@ -765,7 +765,7 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
return AVERROR_INVALIDDATA;
}
- bitstream_init(&f->bc, buf + 4, 8 * bitstream_size);
+ bitstream_init8(&f->bc, buf + 4, bitstream_size);
prestream_size = length + buf - prestream;
@@ -777,7 +777,7 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
prestream_size / 4);
memset((uint8_t*)f->bitstream_buffer + prestream_size,
0, AV_INPUT_BUFFER_PADDING_SIZE);
- bitstream_init(&f->pre_bc, f->bitstream_buffer, 8 * prestream_size);
+ bitstream_init8(&f->pre_bc, f->bitstream_buffer, prestream_size);
f->last_dc = 0 * 128 * 8 * 8;
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index a3344ae695..86aaade846 100644
--- a/libavcodec/adxdec.c
+++ b/libavcodec/adxdec.c
@@ -76,7 +76,7 @@ static int adx_decode(ADXContext *c, int16_t *out, int offset,
if (scale & 0x8000)
return -1;
- bitstream_init(&bc, in + 2, (BLOCK_SIZE - 2) * 8);
+ bitstream_init8(&bc, in + 2, BLOCK_SIZE - 2);
out += offset;
s1 = prev->s1;
s2 = prev->s2;
diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c
index cbda63d3b0..bd87512d13 100644
--- a/libavcodec/asvdec.c
+++ b/libavcodec/asvdec.c
@@ -232,7 +232,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
a->bitstream_buffer[i] = ff_reverse[buf[i]];
}
- bitstream_init(&a->bc, a->bitstream_buffer, buf_size * 8);
+ bitstream_init8(&a->bc, a->bitstream_buffer, buf_size);
for (mb_y = 0; mb_y < a->mb_height2; mb_y++) {
for (mb_x = 0; mb_x < a->mb_width2; mb_x++) {
diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 60be853588..52d43e2c94 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -297,7 +297,7 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data,
for (ch = 0; ch < avctx->channels; ch++) {
AT1SUCtx* su = &q->SUs[ch];
- bitstream_init(&bc, &buf[212 * ch], 212 * 8);
+ bitstream_init8(&bc, &buf[212 * ch], 212);
/* parse block_size_mode, 1st byte */
ret = at1_parse_bsm(&bc, su->log2_block_count);
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index be32a0ec86..2a703ca46e 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -645,7 +645,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
if (q->coding_mode == JOINT_STEREO) {
/* channel coupling mode */
/* decode Sound Unit 1 */
- bitstream_init(&q->bc, databuf, avctx->block_align * 8);
+ bitstream_init8(&q->bc, databuf, avctx->block_align);
ret = decode_channel_sound_unit(q, &q->bc, q->units, out_samples[0], 0,
JOINT_STEREO);
@@ -674,7 +674,7 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
/* set the bitstream reader at the start of the second Sound Unit*/
- bitstream_init(&q->bc, ptr1, (avctx->block_align - i) * 8);
+ bitstream_init8(&q->bc, ptr1, avctx->block_align - i);
/* Fill the Weighting coeffs delay buffer */
memmove(q->weighting_delay, &q->weighting_delay[2],
@@ -705,9 +705,9 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf,
/* Decode the channel sound units. */
for (i = 0; i < avctx->channels; i++) {
/* Set the bitstream reader at the start of a channel sound unit. */
- bitstream_init(&q->bc,
- databuf + i * avctx->block_align / avctx->channels,
- avctx->block_align * 8 / avctx->channels);
+ bitstream_init8(&q->bc,
+ databuf + i * avctx->block_align / avctx->channels,
+ avctx->block_align / avctx->channels);
ret = decode_channel_sound_unit(q, &q->bc, &q->units[i],
out_samples[i], i, q->coding_mode);
diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index bea01a2656..959f570b38 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -125,7 +125,7 @@ avs_decode_frame(AVCodecContext * avctx,
int map_size = ((318 / vect_w + 7) / 8) * (198 / vect_h);
if (buf_end - table < map_size)
return AVERROR_INVALIDDATA;
- bitstream_init(&change_map, table, map_size * 8);
+ bitstream_init8(&change_map, table, map_size);
table += map_size;
}
diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c
index 4c0410dd21..e7cb79caf0 100644
--- a/libavcodec/cdxl.c
+++ b/libavcodec/cdxl.c
@@ -73,7 +73,7 @@ static void bitplanar2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
BitstreamContext bc;
int x, y, plane;
- bitstream_init(&bc, c->video, c->video_size * 8);
+ bitstream_init8(&bc, c->video, c->video_size);
for (plane = 0; plane < c->bpp; plane++) {
for (y = 0; y < c->avctx->height; y++) {
for (x = 0; x < c->avctx->width; x++)
@@ -88,7 +88,7 @@ static void bitline2chunky(CDXLVideoContext *c, int linesize, uint8_t *out)
BitstreamContext bc;
int x, y, plane;
- bitstream_init(&bc, c->video, c->video_size * 8);
+ bitstream_init8(&bc, c->video, c->video_size);
for (y = 0; y < c->avctx->height; y++) {
for (plane = 0; plane < c->bpp; plane++) {
for (x = 0; x < c->avctx->width; x++)
diff --git a/libavcodec/cljrdec.c b/libavcodec/cljrdec.c
index 833707b099..d17212e157 100644
--- a/libavcodec/cljrdec.c
+++ b/libavcodec/cljrdec.c
@@ -56,7 +56,7 @@ static int decode_frame(AVCodecContext *avctx,
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
for (y = 0; y < avctx->height; y++) {
uint8_t *luma = &p->data[0][y * p->linesize[0]];
diff --git a/libavcodec/dss_sp.c b/libavcodec/dss_sp.c
index 44d98d8cf9..4fe784c055 100644
--- a/libavcodec/dss_sp.c
+++ b/libavcodec/dss_sp.c
@@ -315,7 +315,7 @@ static void dss_sp_unpack_coeffs(DssSpContext *p, const uint8_t *src)
p->bits[i + 1] = src[i];
}
- bitstream_init(&bc, p->bits, DSS_SP_FRAME_SIZE * 8);
+ bitstream_init8(&bc, p->bits, DSS_SP_FRAME_SIZE);
for (i = 0; i < 2; i++)
fparam->filter_idx[i] = bitstream_read(&bc, 5);
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 2b9760fb35..6530847dff 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -336,7 +336,7 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
int run_length;
int pixels_read = 0;
- bitstream_init(&bc, *srcbuf, buf_size << 3);
+ bitstream_init8(&bc, *srcbuf, buf_size);
while (bitstream_tell(&bc) < buf_size << 3 && pixels_read < dbuf_len) {
bits = bitstream_read(&bc, 2);
@@ -441,7 +441,7 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
int run_length;
int pixels_read = 0;
- bitstream_init(&bc, *srcbuf, buf_size << 3);
+ bitstream_init8(&bc, *srcbuf, buf_size);
while (bitstream_tell(&bc) < buf_size << 3 && pixels_read < dbuf_len) {
bits = bitstream_read(&bc, 4);
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 9abedcc783..190f4c8955 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -157,7 +157,7 @@ static void tgq_decode_mb(TgqContext *s, AVFrame *frame, int mb_y, int mb_x)
mode = bytestream2_get_byte(&s->gb);
if (mode > 12) {
BitstreamContext bc;
- bitstream_init(&bc, s->gb.buffer, FFMIN(s->gb.buffer_end - s->gb.buffer, mode) * 8);
+ bitstream_init8(&bc, s->gb.buffer, FFMIN(s->gb.buffer_end - s->gb.buffer, mode));
for (i = 0; i < 6; i++)
tgq_decode_block(s, s->block[i], &bc);
tgq_idct_put_mb(s, s->block, frame, mb_x, mb_y);
diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index 549b5b6d3c..3894f2becc 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -207,7 +207,7 @@ static int tgv_decode_inter(TgvContext *s, AVFrame *frame,
buf += num_blocks_raw * 16;
/* read compressed blocks */
- bitstream_init(&bc, buf, (buf_end - buf) << 3);
+ bitstream_init8(&bc, buf, buf_end - buf);
for (i = 0; i < num_blocks_packed; i++) {
int tmp[4];
for (j = 0; j < 4; j++)
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 879f00a73c..86a63a434e 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -217,7 +217,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
unsigned old_stride, new_stride;
int ret;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
// This call also guards the potential depth reads for the
// codebook unpacking.
diff --git a/libavcodec/escape130.c b/libavcodec/escape130.c
index 544f36d1ac..0f2fcae395 100644
--- a/libavcodec/escape130.c
+++ b/libavcodec/escape130.c
@@ -216,7 +216,7 @@ static int escape130_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
return ret;
- bitstream_init(&bc, buf + 16, (buf_size - 16) * 8);
+ bitstream_init8(&bc, buf + 16, buf_size - 16);
new_y = s->new_y;
new_cb = s->new_u;
diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c
index 8a9010d40c..9eb4e37999 100644
--- a/libavcodec/faxcompr.c
+++ b/libavcodec/faxcompr.c
@@ -289,7 +289,7 @@ int ff_ccitt_unpack(AVCodecContext *avctx, const uint8_t *src, int srcsize,
ref[0] = avctx->width;
ref[1] = 0;
ref[2] = 0;
- bitstream_init(&bc, src, srcsize * 8);
+ bitstream_init8(&bc, src, srcsize);
for (j = 0; j < height; j++) {
runend = runs + runsize;
if (compr == TIFF_G4) {
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 20fa7bc1af..252caab25e 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -268,7 +268,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
if (buf_size < 4)
return -1;
- bitstream_init(&bc, avpkt->data, buf_size * 8);
+ bitstream_init8(&bc, avpkt->data, buf_size);
/* start to parse the bitstream */
s->block_width = 16 * (bitstream_read(&bc, 4) + 1);
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c
index 2237991133..fd1dcb7b4a 100644
--- a/libavcodec/fraps.c
+++ b/libavcodec/fraps.c
@@ -111,7 +111,7 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
s->bdsp.bswap_buf((uint32_t *) s->tmpbuf,
(const uint32_t *) src, size >> 2);
- bitstream_init(&bc, s->tmpbuf, size * 8);
+ bitstream_init8(&bc, s->tmpbuf, size);
for (j = 0; j < h; j++) {
for (i = 0; i < w*step; i += step) {
dst[i] = bitstream_read_vlc(&bc, vlc.table, VLC_BITS, 3);
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 4a7f5a3666..511ea534b8 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -298,7 +298,7 @@ static int jpg_decode_data(JPGContext *c, int width, int height,
return ret;
jpg_unescape(src, src_size, c->buf, &unesc_size);
memset(c->buf + unesc_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- bitstream_init(&bc, c->buf, unesc_size * 8);
+ bitstream_init8(&bc, c->buf, unesc_size);
width = FFALIGN(width, 16);
mb_w = width >> 4;
@@ -1015,7 +1015,7 @@ static void kempf_restore_buf(const uint8_t *src, int len,
int i, j, nb, col;
int align_width = FFALIGN(width, 16);
- bitstream_init(&bc, src, len * 8);
+ bitstream_init8(&bc, src, len);
if (npal <= 2) nb = 1;
else if (npal <= 4) nb = 2;
diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c
index f9605c99c5..07af0a082a 100644
--- a/libavcodec/g722dec.c
+++ b/libavcodec/g722dec.c
@@ -103,7 +103,7 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data,
}
out_buf = (int16_t *)frame->data[0];
- bitstream_init(&bc, avpkt->data, avpkt->size * 8);
+ bitstream_init8(&bc, avpkt->data, avpkt->size);
for (j = 0; j < avpkt->size; j++) {
int ilow, ihigh, rlow, rhigh, dhigh;
diff --git a/libavcodec/g723_1dec.c b/libavcodec/g723_1dec.c
index 2ea3bbffa5..0cb5ba70c5 100644
--- a/libavcodec/g723_1dec.c
+++ b/libavcodec/g723_1dec.c
@@ -72,7 +72,7 @@ static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf,
int ad_cb_len;
int temp, info_bits, i;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
/* Extract frame type and rate info */
info_bits = bitstream_read(&bc, 2);
diff --git a/libavcodec/g726.c b/libavcodec/g726.c
index 007cdb63cc..dab038f50c 100644
--- a/libavcodec/g726.c
+++ b/libavcodec/g726.c
@@ -443,7 +443,7 @@ static int g726_decode_frame(AVCodecContext *avctx, void *data,
}
samples = (int16_t *)frame->data[0];
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
while (out_samples--)
*samples++ = g726_decode(c, bitstream_read(&bc, c->code_size));
diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c
index d727cf9ccf..0205fafad0 100644
--- a/libavcodec/gsmdec.c
+++ b/libavcodec/gsmdec.c
@@ -88,7 +88,7 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
switch (avctx->codec_id) {
case AV_CODEC_ID_GSM:
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
if (bitstream_read(&bc, 4) != 0xd)
av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n");
res = gsm_decode_block(avctx, samples, &bc, GSM_13000);
diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index 0d03e593f3..2afe8531be 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -160,8 +160,8 @@ static int hq_decode_frame(HQContext *ctx, AVFrame *pic,
"Invalid slice size %zu.\n", data_size);
break;
}
- bitstream_init(&bc, src + slice_off[slice],
- (slice_off[slice + 1] - slice_off[slice]) * 8);
+ bitstream_init8(&bc, src + slice_off[slice],
+ slice_off[slice + 1] - slice_off[slice]);
for (i = 0; i < (next_off - start_off) * profile->tab_w; i++) {
ret = hq_decode_mb(ctx, pic, &bc, perm[0] * 16, perm[1] * 16);
@@ -285,8 +285,8 @@ static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, size_t data_size)
"Invalid slice size %zu.\n", data_size);
break;
}
- bitstream_init(&bc, src + slice_off[slice],
- (slice_off[slice + 1] - slice_off[slice]) * 8);
+ bitstream_init8(&bc, src + slice_off[slice],
+ slice_off[slice + 1] - slice_off[slice]);
ret = hqa_decode_slice(ctx, pic, &bc, quant, slice, width, height);
if (ret < 0)
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 01ab0125f2..145b2d56fc 100644
--- a/libavcodec/imc.c
+++ b/libavcodec/imc.c
@@ -1016,7 +1016,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
q->bdsp.bswap16_buf(buf16, (const uint16_t *) buf, IMC_BLOCK_SIZE / 2);
- bitstream_init(&q->bc, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
+ bitstream_init8(&q->bc, (const uint8_t *)buf16, IMC_BLOCK_SIZE);
buf += IMC_BLOCK_SIZE;
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index de2a9bb2f1..811056dbfc 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -171,7 +171,7 @@ static int ir2_decode_frame(AVCodecContext *avctx,
buf[i] = ff_reverse[buf[i]];
#endif
- bitstream_init(&s->bc, buf + start, (buf_size - start) * 8);
+ bitstream_init8(&s->bc, buf + start, buf_size - start);
ltab = buf[0x22] & 3;
ctab = buf[0x22] >> 2;
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c
index 37d85e1abc..22a072dea3 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -857,7 +857,7 @@ static int decode_plane(Indeo3DecodeContext *ctx, AVCodecContext *avctx,
ctx->mc_vectors = num_vectors ? data : 0;
/* init the bitreader */
- bitstream_init(&ctx->bc, &data[num_vectors * 2], (data_size - num_vectors * 2) << 3);
+ bitstream_init8(&ctx->bc, &data[num_vectors * 2], data_size - num_vectors * 2);
ctx->skip_bits = 0;
ctx->need_resync = 0;
diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c
index fab9f2724c..f5593d347a 100644
--- a/libavcodec/interplayvideo.c
+++ b/libavcodec/interplayvideo.c
@@ -898,7 +898,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame)
s->upper_motion_limit_offset = (s->avctx->height - 8) * frame->linesize[0]
+ (s->avctx->width - 8) * (1 + s->is_16bpp);
- bitstream_init(&bc, s->decoding_map, s->decoding_map_size * 8);
+ bitstream_init8(&bc, s->decoding_map, s->decoding_map_size);
for (y = 0; y < s->avctx->height; y += 8) {
for (x = 0; x < s->avctx->width; x += 8) {
opcode = bitstream_read(&bc, 4);
diff --git a/libavcodec/ivi.c b/libavcodec/ivi.c
index a83773443c..2ff4824c92 100644
--- a/libavcodec/ivi.c
+++ b/libavcodec/ivi.c
@@ -1029,7 +1029,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int buf_size = avpkt->size;
int result, p, b;
- bitstream_init(&ctx->bc, buf, buf_size * 8);
+ bitstream_init8(&ctx->bc, buf, buf_size);
ctx->frame_data = buf;
ctx->frame_size = buf_size;
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 37a2770063..5f5a825cd7 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -164,7 +164,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (video_type == 0 || video_type == 1) {
BitstreamContext bc;
- bitstream_init(&bc, buf, 8 * FFMIN(video_size, buf_end - buf));
+ bitstream_init8(&bc, buf, FFMIN(video_size, buf_end - buf));
for (j = 0; j < avctx->height; j += 8)
for (i = 0; i < avctx->width; i += 8)
diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index d9667b7afc..95e6aba251 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -436,7 +436,7 @@ static int lag_decode_arith_plane(LagarithContext *l, uint8_t *dst,
offset += 4;
}
- bitstream_init(&bc, src + offset, src_size * 8);
+ bitstream_init8(&bc, src + offset, src_size);
if (lag_read_prob_header(&rac, &bc) < 0)
return -1;
diff --git a/libavcodec/metasound.c b/libavcodec/metasound.c
index ac6d9cd1c0..4cd9051dbd 100644
--- a/libavcodec/metasound.c
+++ b/libavcodec/metasound.c
@@ -172,7 +172,7 @@ static int metasound_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
BitstreamContext bc;
int i, j, k;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
for (tctx->cur_frame = 0; tctx->cur_frame < tctx->frames_per_packet;
tctx->cur_frame++) {
diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c
index 34d2587cfe..1ec27b2926 100644
--- a/libavcodec/mimic.c
+++ b/libavcodec/mimic.c
@@ -426,7 +426,7 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
ctx->bbdsp.bswap_buf(ctx->swap_buf,
(const uint32_t *) (buf + MIMIC_HEADER_SIZE),
swap_buf_size >> 2);
- bitstream_init(&ctx->bc, ctx->swap_buf, swap_buf_size << 3);
+ bitstream_init8(&ctx->bc, ctx->swap_buf, swap_buf_size);
res = decode(ctx, quality, num_coeffs, !is_pframe);
ff_thread_report_progress(&ctx->frames[ctx->cur_index], INT_MAX, 0);
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 45764e83f2..e9ba840200 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -332,7 +332,7 @@ static int mlp_parse(AVCodecParserContext *s,
BitstreamContext bc;
MLPHeaderInfo mh;
- bitstream_init(&bc, buf + 4, (buf_size - 4) << 3);
+ bitstream_init8(&bc, buf + 4, buf_size - 4);
if (ff_mlp_read_major_sync(avctx, &mh, &bc) < 0)
goto lost_sync;
diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index 40889161f8..a606213f97 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1095,7 +1095,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
if (length < 4 || length > buf_size)
return AVERROR_INVALIDDATA;
- bitstream_init(&bc, (buf + 4), (length - 4) * 8);
+ bitstream_init8(&bc, buf + 4, length - 4);
m->is_major_sync_unit = 0;
if (bitstream_peek(&bc, 31) == (0xf8726fba >> 1)) {
@@ -1175,7 +1175,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
for (substr = 0; substr <= m->max_decoded_substream; substr++) {
SubStream *s = &m->substream[substr];
- bitstream_init(&bc, buf, substream_data_len[substr] * 8);
+ bitstream_init8(&bc, buf, substream_data_len[substr]);
m->matrix_changed = 0;
memset(m->filter_changed, 0, sizeof(m->filter_changed));
diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c
index 333f18fdb2..da4c141db6 100644
--- a/libavcodec/motionpixels.c
+++ b/libavcodec/motionpixels.c
@@ -285,7 +285,7 @@ static int mp_decode_frame(AVCodecContext *avctx,
if (buf_size & 3)
memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
memset(mp->bswapbuf + buf_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
- bitstream_init(&bc, mp->bswapbuf, buf_size * 8);
+ bitstream_init8(&bc, mp->bswapbuf, buf_size);
memset(mp->changes_map, 0, avctx->width * avctx->height);
for (i = !(avctx->extradata[1] & 2); i < 2; ++i) {
diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c
index 5d749106de..66a6162ec5 100644
--- a/libavcodec/mpc7.c
+++ b/libavcodec/mpc7.c
@@ -238,7 +238,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
return AVERROR(ENOMEM);
c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf,
buf_size >> 2);
- bitstream_init(&bc, c->bits, buf_size * 8);
+ bitstream_init8(&bc, c->bits, buf_size);
bitstream_skip(&bc, skip);
/* read subband indexes */
diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c
index cf621afb12..f55fd57824 100644
--- a/libavcodec/mpc8.c
+++ b/libavcodec/mpc8.c
@@ -259,7 +259,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
memset(c->Q, 0, sizeof(c->Q));
c->last_bits_used = 0;
}
- bitstream_init(bc, buf, buf_size * 8);
+ bitstream_init8(bc, buf, buf_size);
bitstream_skip(bc, c->last_bits_used & 7);
if(keyframe)
diff --git a/libavcodec/msgsmdec.c b/libavcodec/msgsmdec.c
index c26efa9fae..01ea95f43b 100644
--- a/libavcodec/msgsmdec.c
+++ b/libavcodec/msgsmdec.c
@@ -32,7 +32,7 @@ int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples,
{
int res;
BitstreamContext bc;
- bitstream_init(&bc, buf, GSM_MS_BLOCK_SIZE * 8);
+ bitstream_init8(&bc, buf, GSM_MS_BLOCK_SIZE);
res = gsm_decode_block(avctx, samples, &bc, mode);
if (res < 0)
return res;
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index 390872c89a..8d9af5fff6 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -67,7 +67,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
int bits[NELLY_BUF_LEN];
unsigned char v;
- bitstream_init(&s->bc, block, NELLY_BLOCK_LEN * 8);
+ bitstream_init8(&s->bc, block, NELLY_BLOCK_LEN);
bptr = buf;
pptr = pows;
@@ -88,7 +88,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
for (i = 0; i < 2; i++) {
aptr = audio + i * NELLY_BUF_LEN;
- bitstream_init(&s->bc, block, NELLY_BLOCK_LEN * 8);
+ bitstream_init8(&s->bc, block, NELLY_BLOCK_LEN);
bitstream_skip(&s->bc, NELLY_HEADER_BITS + i * NELLY_DETAIL_BITS);
for (j = 0; j < NELLY_FILL_LEN; j++) {
diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index ece885e6e0..f4a6a9196f 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -183,7 +183,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
BitstreamContext s;
for (y = 0; y < h; y++) {
- bitstream_init(&s, scanline, bytes_per_scanline << 3);
+ bitstream_init8(&s, scanline, bytes_per_scanline);
pcx_rle_decode(&gb, scanline, bytes_per_scanline, compressed);
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 9d5e13a117..83be57a427 100644
--- a/libavcodec/qcelpdec.c
+++ b/libavcodec/qcelpdec.c
@@ -719,7 +719,7 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data,
qcelp_unpacking_bitmaps_lengths[q->bitrate];
uint8_t *unpacked_data = (uint8_t *)&q->frame;
- bitstream_init(&q->bc, buf, 8 * buf_size);
+ bitstream_init8(&q->bc, buf, buf_size);
memset(&q->frame, 0, sizeof(QCELPFrame));
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index 781999aa10..00c952d51a 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1105,7 +1105,7 @@ static void process_subpacket_9(QDM2Context *q, QDM2SubPNode *node)
BitstreamContext bc;
int i, j, k, n, ch, run, level, diff;
- bitstream_init(&bc, node->packet->data, node->packet->size * 8);
+ bitstream_init8(&bc, node->packet->data, node->packet->size);
n = coeff_per_sb_for_avg[q->coeff_per_sb_select][QDM2_SB_USED(q->sub_sampling) - 1] + 1;
@@ -1142,7 +1142,7 @@ static void process_subpacket_10(QDM2Context *q, QDM2SubPNode *node)
BitstreamContext bc;
if (node) {
- bitstream_init(&bc, node->packet->data, node->packet->size * 8);
+ bitstream_init8(&bc, node->packet->data, node->packet->size);
init_tone_level_dequantization(q, &bc);
fill_tone_level_array(q, 1);
} else {
@@ -1252,7 +1252,7 @@ static void qdm2_decode_super_block(QDM2Context *q)
average_quantized_coeffs(q); // average elements in quantized_coeffs[max_ch][10][8]
- bitstream_init(&bc, q->compressed_data, q->compressed_size * 8);
+ bitstream_init8(&bc, q->compressed_data, q->compressed_size);
qdm2_decode_sub_packet_header(&bc, &header);
if (header.type < 2 || header.type >= 8) {
@@ -1264,7 +1264,7 @@ static void qdm2_decode_super_block(QDM2Context *q)
q->superblocktype_2_3 = (header.type == 2 || header.type == 3);
packet_bytes = (q->compressed_size - bitstream_tell(&bc) / 8);
- bitstream_init(&bc, header.data, header.size * 8);
+ bitstream_init8(&bc, header.data, header.size);
if (header.type == 2 || header.type == 4 || header.type == 5) {
int csum = 257 * bitstream_read(&bc, 8);
@@ -1300,7 +1300,7 @@ static void qdm2_decode_super_block(QDM2Context *q)
q->sub_packet_list_A[i - 1].next = &q->sub_packet_list_A[i];
/* seek to next block */
- bitstream_init(&bc, header.data, header.size * 8);
+ bitstream_init8(&bc, header.data, header.size);
bitstream_skip(&bc, next_index * 8);
if (next_index >= header.size)
@@ -1495,7 +1495,7 @@ static void qdm2_decode_fft_packets(QDM2Context *q)
return;
/* decode FFT tones */
- bitstream_init(&bc, packet->data, packet->size * 8);
+ bitstream_init8(&bc, packet->data, packet->size);
if (packet->type >= 32 && packet->type < 48 && !fft_subpackets[packet->type - 16])
unknown_flag = 1;
diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c
index 35ee697731..05165bf2e4 100644
--- a/libavcodec/ra144dec.c
+++ b/libavcodec/ra144dec.c
@@ -92,7 +92,7 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
}
samples = (int16_t *)frame->data[0];
- bitstream_init(&bc, buf, FRAMESIZE * 8);
+ bitstream_init8(&bc, buf, FRAMESIZE);
for (i = 0; i < LPC_ORDER; i++)
lpc_refl[i] = ff_lpc_refl_cb[i][bitstream_read(&bc, sizes[i])];
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index bc3fe29dc1..c457d0c710 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -198,7 +198,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
}
out = (float *)frame->data[0];
- bitstream_init(&bc, buf, avctx->block_align * 8);
+ bitstream_init8(&bc, buf, avctx->block_align);
for (i=0; i < RA288_BLOCKS_PER_FRAME; i++) {
float gain = amptable[bitstream_read(&bc, 3)];
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index 027728e387..2abf7c1c5a 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -302,7 +302,7 @@ static int decode_header_trees(SmackVContext *smk) {
full_size = AV_RL32(smk->avctx->extradata + 8);
type_size = AV_RL32(smk->avctx->extradata + 12);
- bitstream_init(&bc, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
+ bitstream_init8(&bc, smk->avctx->extradata + 16, smk->avctx->extradata_size - 16);
if (!bitstream_read_bit(&bc)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
@@ -417,7 +417,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
last_reset(smk->mclr_tbl, smk->mclr_last);
last_reset(smk->full_tbl, smk->full_last);
last_reset(smk->type_tbl, smk->type_last);
- bitstream_init(&bc, avpkt->data + 769, (avpkt->size - 769) * 8);
+ bitstream_init8(&bc, avpkt->data + 769, avpkt->size - 769);
blk = 0;
bw = avctx->width >> 2;
@@ -618,7 +618,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
unp_size = AV_RL32(buf);
- bitstream_init(&bc, buf + 4, (buf_size - 4) * 8);
+ bitstream_init8(&bc, buf + 4, buf_size - 4);
if (!bitstream_read_bit(&bc)) {
av_log(avctx, AV_LOG_INFO, "Sound: no data\n");
diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
index 2ab0f238bb..bce04e807d 100644
--- a/libavcodec/svq1dec.c
+++ b/libavcodec/svq1dec.c
@@ -616,7 +616,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
svq1_pmv *pmv;
/* initialize bit buffer */
- bitstream_init(&s->bc, buf, buf_size * 8);
+ bitstream_init8(&s->bc, buf, buf_size);
/* decode frame header */
s->frame_code = bitstream_read(&s->bc, 22);
@@ -647,7 +647,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < 4; i++)
src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
- bitstream_init(&s->bc, buf, buf_size * 8);
+ bitstream_init8(&s->bc, buf, buf_size);
bitstream_skip(&s->bc, 22);
}
diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c
index d95226678b..e24d4018c9 100644
--- a/libavcodec/tiertexseqv.c
+++ b/libavcodec/tiertexseqv.c
@@ -45,7 +45,7 @@ static const unsigned char *seq_unpack_rle_block(const unsigned char *src,
int code_table[64];
/* get the rle codes */
- bitstream_init(&bc, src, (src_end - src) * 8);
+ bitstream_init8(&bc, src, src_end - src);
for (i = 0, sz = 0; i < 64 && sz < dst_size; i++) {
if (bitstream_bits_left(&bc) < 4)
return NULL;
@@ -113,7 +113,7 @@ static const unsigned char *seq_decode_op1(SeqVideoContext *seq,
return NULL;
color_table = src;
src += len;
- bitstream_init(&bc, src, bits * 8 * 8);
+ bitstream_init8(&bc, src, bits * 8);
src += bits * 8;
for (b = 0; b < 8; b++) {
for (i = 0; i < 8; i++)
@@ -188,7 +188,7 @@ static int seqvideo_decode(SeqVideoContext *seq, const unsigned char *data, int
if (flags & 2) {
if (data_end - data < 128)
return AVERROR_INVALIDDATA;
- bitstream_init(&bc, data, 128 * 8);
+ bitstream_init8(&bc, data, 128);
data += 128;
for (y = 0; y < 128; y += 8)
for (x = 0; x < 256; x += 8) {
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index 99884be4bb..333451cb7c 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -306,7 +306,7 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
pos = bytestream2_tell(&gb);
if (skip <= pos)
return AVERROR_INVALIDDATA;
- bitstream_init(&ctx->bc, buf + pos, (skip - pos) * 8);
+ bitstream_init8(&ctx->bc, buf + pos, skip - pos);
if ((ret = tm2_read_deltas(ctx, stream_id)) < 0)
return ret;
bytestream2_skip(&gb, ((bitstream_tell(&ctx->bc) + 31) >> 5) << 2);
@@ -323,7 +323,7 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
pos = bytestream2_tell(&gb);
if (skip <= pos)
return AVERROR_INVALIDDATA;
- bitstream_init(&ctx->bc, buf + pos, (skip - pos) * 8);
+ bitstream_init8(&ctx->bc, buf + pos, skip - pos);
if ((ret = tm2_build_huff_table(ctx, &codes)) < 0)
return ret;
bytestream2_skip(&gb, ((bitstream_tell(&ctx->bc) + 31) >> 5) << 2);
@@ -342,7 +342,7 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i
pos = bytestream2_tell(&gb);
if (skip <= pos)
return AVERROR_INVALIDDATA;
- bitstream_init(&ctx->bc, buf + pos, (skip - pos) * 8);
+ bitstream_init8(&ctx->bc, buf + pos, skip - pos);
for (i = 0; i < toks; i++) {
if (bitstream_bits_left(&ctx->bc) <= 0) {
av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks);
diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c
index 48e2126ba6..6b9afaedda 100644
--- a/libavcodec/truespeech.c
+++ b/libavcodec/truespeech.c
@@ -82,7 +82,7 @@ static void truespeech_read_frame(TSContext *dec, const uint8_t *input)
BitstreamContext bc;
dec->bdsp.bswap_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8);
- bitstream_init(&bc, dec->buffer, 32 * 8);
+ bitstream_init8(&bc, dec->buffer, 32);
dec->vector[7] = ts_codebook[7][bitstream_read(&bc, 3)];
dec->vector[6] = ts_codebook[6][bitstream_read(&bc, 3)];
diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c
index d86428afc6..6081c72c30 100644
--- a/libavcodec/tscc2.c
+++ b/libavcodec/tscc2.c
@@ -195,7 +195,7 @@ static int tscc2_decode_slice(TSCC2Context *c, int mb_y,
int i, mb_x, q, ret;
int off;
- bitstream_init(&c->bc, buf, buf_size * 8);
+ bitstream_init8(&c->bc, buf, buf_size);
for (mb_x = 0; mb_x < c->mb_width; mb_x++) {
q = c->slice_quants[mb_x + c->mb_width * mb_y];
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 7fe11f5830..db5e094a2e 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -197,7 +197,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
if (avctx->extradata_size < 30)
return -1;
- bitstream_init(&s->bc, avctx->extradata, avctx->extradata_size * 8);
+ bitstream_init8(&s->bc, avctx->extradata, avctx->extradata_size);
if (bitstream_peek(&s->bc, 32) == AV_RL32("TTA1")) {
if (avctx->err_recognition & AV_EF_CRCCHECK) {
s->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
@@ -315,7 +315,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- bitstream_init(&s->bc, buf, buf_size * 8);
+ bitstream_init8(&s->bc, buf, buf_size);
/* get output buffer */
frame->nb_samples = framelen;
diff --git a/libavcodec/twinvqdec.c b/libavcodec/twinvqdec.c
index 6355ad4ed2..8981d95408 100644
--- a/libavcodec/twinvqdec.c
+++ b/libavcodec/twinvqdec.c
@@ -259,7 +259,7 @@ static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx,
BitstreamContext bc;
int i, j, k;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
bitstream_skip(&bc, bitstream_read(&bc, 8));
bits->window_type = bitstream_read(&bc, TWINVQ_WINDOW_TYPE_BITS);
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 29de815d4e..1f5b02f560 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -147,7 +147,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
(uint32_t *) c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2);
- bitstream_init(&bc, c->slice_bits, slice_size * 8);
+ bitstream_init8(&bc, c->slice_bits, slice_size);
prev = 0x80;
for (j = sstart; j < send; j++) {
diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index fef10903dd..75db27ff09 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -140,7 +140,7 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (version != 1)
av_log(avctx, AV_LOG_WARNING, "Unsupported VBLE Version: %d\n", version);
- bitstream_init(&bc, src + 4, (avpkt->size - 4) * 8);
+ bitstream_init8(&bc, src + 4, avpkt->size - 4);
/* Unpack */
if (vble_unpack(ctx, &bc) < 0) {
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index a6ab52bf83..4548e5fb3b 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1039,7 +1039,7 @@ static int apply_color_indexing_transform(WebPContext *s)
for (y = 0; y < img->frame->height; y++) {
p = GET_PIXEL(img->frame, 0, y);
memcpy(line, p, img->frame->linesize[0]);
- bitstream_init(&bc_g, line, img->frame->linesize[0] * 8);
+ bitstream_init8(&bc_g, line, img->frame->linesize[0]);
bitstream_skip(&bc_g, 16);
i = 0;
for (x = 0; x < img->frame->width; x++) {
@@ -1083,7 +1083,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p,
avctx->pix_fmt = AV_PIX_FMT_ARGB;
}
- ret = bitstream_init(&s->bc, data_start, data_size * 8);
+ ret = bitstream_init8(&s->bc, data_start, data_size);
if (ret < 0)
return ret;
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index 80d66ae96c..e973f7ecc5 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -90,7 +90,7 @@ static int decode_frame(AVCodecContext *avctx,
for (i = 8; i < buf_size; i++)
rbuf[i] = ff_reverse[buf[i]];
- bitstream_init(&l->bc, rbuf + 8, (buf_size - 8) * 8);
+ bitstream_init8(&l->bc, rbuf + 8, buf_size - 8);
if (buf[2] >> 4 == 6)
l->shift = 2;
diff --git a/libavcodec/xan.c b/libavcodec/xan.c
index 33149e5ff7..5bb4f161e4 100644
--- a/libavcodec/xan.c
+++ b/libavcodec/xan.c
@@ -129,7 +129,7 @@ static int xan_huffman_decode(unsigned char *dest, int dest_len,
if (ptr_len < 0)
return AVERROR_INVALIDDATA;
- bitstream_init(&bc, ptr, ptr_len * 8);
+ bitstream_init8(&bc, ptr, ptr_len);
while (val != 0x16) {
unsigned idx = val - 0x17 + bitstream_read_bit(&bc) * byte;
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index a07f94ce73..635067c0c8 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -147,7 +147,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
// process RLE-compressed data
- bitstream_init(&bc, buf, (buf_end - buf) * 8);
+ bitstream_init8(&bc, buf, buf_end - buf);
bitmap = sub->rects[0]->data[0];
for (y = 0; y < h; y++) {
// interlaced: do odd lines
diff --git a/libavformat/h261dec.c b/libavformat/h261dec.c
index d8a2cecc77..54202945ca 100644
--- a/libavformat/h261dec.c
+++ b/libavformat/h261dec.c
@@ -34,7 +34,7 @@ static int h261_probe(AVProbeData *p)
int src_fmt=0;
BitstreamContext bc;
- bitstream_init(&bc, p->buf, p->buf_size * 8);
+ bitstream_init8(&bc, p->buf, p->buf_size);
for(i=0; i<p->buf_size*8; i++){
if ((code & 0x01ff0000) || !(code & 0xff00)) {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 9afd0202ca..2810960e87 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2138,7 +2138,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return ret;
}
- bitstream_init(&bc, buf, 8 * num_bytes);
+ bitstream_init8(&bc, buf, num_bytes);
for (i = 0; i < entries && !pb->eof_reached; i++) {
sc->sample_sizes[i] = bitstream_read(&bc, field_size);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 440370e259..840190dbfa 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -252,7 +252,7 @@ static int mov_write_ac3_tag(AVIOContext *pb, MOVTrack *track)
avio_wb32(pb, 11);
ffio_wfourcc(pb, "dac3");
- bitstream_init(&bc, track->vos_data + 4, (track->vos_len - 4) * 8);
+ bitstream_init8(&bc, track->vos_data + 4, track->vos_len - 4);
fscod = bitstream_read(&bc, 2);
frmsizecod = bitstream_read(&bc, 6);
bsid = bitstream_read(&bc, 5);
@@ -470,7 +470,7 @@ static int mov_write_dvc1_structs(MOVTrack *track, uint8_t *buf)
if (size <= 0)
continue;
unescaped_size = vc1_unescape_buffer(start + 4, size, unescaped);
- bitstream_init(&bc, unescaped, 8 * unescaped_size);
+ bitstream_init8(&bc, unescaped, unescaped_size);
if (AV_RB32(start) == VC1_CODE_SEQHDR) {
int profile = bitstream_read(&bc, 2);
if (profile != PROFILE_ADVANCED) {
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 5024404111..dc9339fa3e 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -742,7 +742,7 @@ static int read_sl_header(PESContext *pes, SLConfigDescr *sl,
int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
int dts_flag = -1, cts_flag = -1;
int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
if (sl->use_au_start)
au_start_flag = bitstream_read_bit(&bc);
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c
index 90b1495c51..0946a3b7cf 100644
--- a/libavformat/oggparseflac.c
+++ b/libavformat/oggparseflac.c
@@ -41,7 +41,7 @@ flac_header (AVFormatContext * s, int idx)
if (os->buf[os->pstart] == 0xff)
return 0;
- bitstream_init(&bc, os->buf + os->pstart, os->psize * 8);
+ bitstream_init8(&bc, os->buf + os->pstart, os->psize);
bitstream_skip(&bc, 1); /* metadata_last */
mdt = bitstream_read(&bc, 7);
diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
index da47a0cd89..d9992fab9c 100644
--- a/libavformat/oggparsetheora.c
+++ b/libavformat/oggparsetheora.c
@@ -63,7 +63,7 @@ static int theora_header(AVFormatContext *s, int idx)
BitstreamContext bc;
AVRational timebase;
- bitstream_init(&bc, os->buf + os->pstart, os->psize * 8);
+ bitstream_init8(&bc, os->buf + os->pstart, os->psize);
/* 0x80"theora" */
bitstream_skip(&bc, 7 * 8);
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index da5ff59c22..825e4f1355 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -262,7 +262,7 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
* [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
* http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
*/
- bitstream_init(&bc, buf, len << 3);
+ bitstream_init8(&bc, buf, len);
len_included = bitstream_read_bit(&bc);
need_reliable = bitstream_read_bit(&bc);
set_id = bitstream_read(&bc, 5);
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index bb826269b0..9893aeba9b 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -103,7 +103,7 @@ static int parse_fmtp_config(AVStream *st, const char *value)
if (!config)
return AVERROR(ENOMEM);
ff_hex_to_data(config, value);
- bitstream_init(&bc, config, len * 8);
+ bitstream_init8(&bc, config, len);
audio_mux_version = bitstream_read(&bc, 1);
same_time_framing = bitstream_read(&bc, 1);
bitstream_skip(&bc, 6); /* num_sub_frames */
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index b3cd6c9404..2a7e54aabc 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -136,7 +136,7 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
if (len < data->au_headers_length_bytes)
return AVERROR_INVALIDDATA;
- bitstream_init(&bctx, buf, data->au_headers_length_bytes * 8);
+ bitstream_init8(&bctx, buf, data->au_headers_length_bytes);
/* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
au_header_size = data->sizelength + data->indexlength;
diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c
index 2c0f8188b6..e6c586fe50 100644
--- a/libavformat/rtpdec_qt.c
+++ b/libavformat/rtpdec_qt.c
@@ -72,7 +72,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
* The RTP payload is described in:
* http://developer.apple.com/quicktime/icefloe/dispatch026.html
*/
- bitstream_init(&bc, buf, len << 3);
+ bitstream_init8(&bc, buf, len);
ffio_init_context(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
if (len < 4)
diff --git a/libavformat/rtpenc_h263_rfc2190.c b/libavformat/rtpenc_h263_rfc2190.c
index 750a52bcd8..3b3479aeb2 100644
--- a/libavformat/rtpenc_h263_rfc2190.c
+++ b/libavformat/rtpenc_h263_rfc2190.c
@@ -112,7 +112,7 @@ void ff_rtp_send_h263_rfc2190(AVFormatContext *s1, const uint8_t *buf, int size,
s->timestamp = s->cur_timestamp;
- bitstream_init(&bc, buf, size * 8);
+ bitstream_init8(&bc, buf, size);
if (bitstream_read(&bc, 22) == 0x20) { /* Picture Start Code */
info.tr = bitstream_read(&bc, 8);
bitstream_skip(&bc, 2); /* PTYPE start, H.261 disambiguation */