---
libavcodec/4xm.c | 6 +++---
libavcodec/aacdec.c | 4 ++--
libavcodec/ac3dec.c | 2 +-
libavcodec/adxdec.c | 2 +-
libavcodec/asvdec.c | 2 +-
libavcodec/atrac1.c | 2 +-
libavcodec/atrac3.c | 10 +++++-----
libavcodec/avs.c | 2 +-
libavcodec/binkaudio.c | 2 +-
libavcodec/cdxl.c | 4 ++--
libavcodec/cljrdec.c | 2 +-
libavcodec/dss_sp.c | 2 +-
libavcodec/dvbsubdec.c | 4 ++--
libavcodec/dxva2_mpeg2.c | 2 +-
libavcodec/eatgq.c | 2 +-
libavcodec/eatgv.c | 2 +-
libavcodec/escape124.c | 2 +-
libavcodec/escape130.c | 2 +-
libavcodec/faxcompr.c | 2 +-
libavcodec/flac_parser.c | 2 +-
libavcodec/flashsv.c | 2 +-
libavcodec/fraps.c | 2 +-
libavcodec/g2meet.c | 4 ++--
libavcodec/g722dec.c | 2 +-
libavcodec/g723_1dec.c | 2 +-
libavcodec/g726.c | 2 +-
libavcodec/gsmdec.c | 2 +-
libavcodec/hq_hqa.c | 8 ++++----
libavcodec/huffyuvdec.c | 14 +++++++-------
libavcodec/imc.c | 2 +-
libavcodec/indeo2.c | 2 +-
libavcodec/indeo3.c | 2 +-
libavcodec/interplayvideo.c | 2 +-
libavcodec/ivi.c | 2 +-
libavcodec/jvdec.c | 2 +-
libavcodec/lagarith.c | 2 +-
libavcodec/metasound.c | 2 +-
libavcodec/mimic.c | 2 +-
libavcodec/mjpegbdec.c | 12 ++++++------
libavcodec/mlp_parser.c | 2 +-
libavcodec/mlpdec.c | 4 ++--
libavcodec/motionpixels.c | 2 +-
libavcodec/mpc7.c | 2 +-
libavcodec/mpc8.c | 2 +-
libavcodec/mpegaudiodec_template.c | 4 ++--
libavcodec/msgsmdec.c | 2 +-
libavcodec/nellymoserdec.c | 4 ++--
libavcodec/pcx.c | 2 +-
libavcodec/proresdec.c | 4 ++--
libavcodec/qcelpdec.c | 2 +-
libavcodec/qdm2.c | 12 ++++++------
libavcodec/ra144dec.c | 2 +-
libavcodec/ra288.c | 2 +-
libavcodec/smacker.c | 6 +++---
libavcodec/svq1dec.c | 4 ++--
libavcodec/tiertexseqv.c | 6 +++---
libavcodec/truemotion2.c | 6 +++---
libavcodec/truespeech.c | 2 +-
libavcodec/tscc2.c | 2 +-
libavcodec/tta.c | 4 ++--
libavcodec/twinvqdec.c | 2 +-
libavcodec/utvideodec.c | 2 +-
libavcodec/vaapi_mpeg2.c | 2 +-
libavcodec/vble.c | 2 +-
libavcodec/vc1dec.c | 9 +++------
libavcodec/vorbis_parser.c | 4 ++--
libavcodec/vorbisdec.c | 6 +++---
libavcodec/vp3.c | 4 ++--
libavcodec/vp6.c | 2 +-
libavcodec/webp.c | 4 ++--
libavcodec/wmadec.c | 4 ++--
libavcodec/wmavoice.c | 6 +++---
libavcodec/wnv1.c | 2 +-
libavcodec/xan.c | 2 +-
libavcodec/xsubdec.c | 2 +-
libavformat/adtsenc.c | 2 +-
libavformat/h261dec.c | 2 +-
libavformat/mov.c | 2 +-
libavformat/movenc.c | 4 ++--
libavformat/mpegts.c | 2 +-
libavformat/oggparseflac.c | 2 +-
libavformat/oggparsetheora.c | 2 +-
libavformat/rdt.c | 2 +-
libavformat/rtpdec_latm.c | 2 +-
libavformat/rtpdec_mpeg4.c | 2 +-
libavformat/rtpdec_qt.c | 2 +-
libavformat/rtpenc_h263_rfc2190.c | 2 +-
87 files changed, 139 insertions(+), 142 deletions(-)
diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c
index ee9d020..28f8391 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/aacdec.c b/libavcodec/aacdec.c
index 53fa039..6ce3d70 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2987,7 +2987,7 @@ static int aac_decode_frame(AVCodecContext *avctx, void
*data,
}
}
- if ((err = bitstream_init(&bc, buf, buf_size * 8)) < 0)
+ if ((err = bitstream_init8(&bc, buf, buf_size)) < 0)
return err;
switch (ac->oc[1].m4ac.object_type) {
@@ -3244,7 +3244,7 @@ static int latm_decode_frame(AVCodecContext *avctx, void
*out,
int muxlength, err;
BitstreamContext bc;
- if ((err = bitstream_init(&bc, avpkt->data, avpkt->size * 8)) < 0)
+ if ((err = bitstream_init8(&bc, avpkt->data, avpkt->size)) < 0)
return err;
// check for LOAS sync word
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index dcd12e1..b1a3c8d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1324,7 +1324,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void
*data,
memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
buf = s->input_buffer;
/* initialize the BitstreamContext with the start of a valid AC-3 Frame */
- bitstream_init(&s->bc, buf, buf_size * 8);
+ bitstream_init8(&s->bc, buf, buf_size);
/* parse the syncinfo */
err = parse_frame_header(s);
diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c
index a3344ae..86aaade 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 cbda63d..bd87512 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 b8fd188..d120ea3 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 be32a0e..2a703ca 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 bea01a2..959f570 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/binkaudio.c b/libavcodec/binkaudio.c
index cf61135..4917535 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -309,7 +309,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return AVERROR(ENOMEM);
s->packet_buffer = buf;
memcpy(s->packet_buffer, avpkt->data, avpkt->size);
- bitstream_init(bc, s->packet_buffer, avpkt->size * 8);
+ bitstream_init8(bc, s->packet_buffer, avpkt->size);
consumed = avpkt->size;
/* skip reported size */
diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c
index 4c0410d..e7cb79c 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 833707b..d17212e 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 44d98d8..4fe784c 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 0c5624d..7a9bb2e 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -451,7 +451,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);
@@ -556,7 +556,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/dxva2_mpeg2.c b/libavcodec/dxva2_mpeg2.c
index 4e32742..fd320a1 100644
--- a/libavcodec/dxva2_mpeg2.c
+++ b/libavcodec/dxva2_mpeg2.c
@@ -145,7 +145,7 @@ static void fill_slice(AVCodecContext *avctx,
slice->wNumberMBsInSlice = (s->mb_y >> is_field) * s->mb_width + s->mb_x;
slice->wBadSliceChopping = 0;
- bitstream_init(&bc, &buffer[4], 8 * (size - 4));
+ bitstream_init8(&bc, &buffer[4], size - 4);
slice->wQuantizerScaleCode = bitstream_read(&bc, 5);
while (bitstream_read_bit(&bc))
diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 9f29428..5050072 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 458f16a..d8e38af 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -208,7 +208,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 c9edca4..2d6dfb6 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -221,7 +221,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 544f36d..0f2fcae 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 8a9010d..9eb4e37 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/flac_parser.c b/libavcodec/flac_parser.c
index 80ea1eb..3f1a470 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -93,7 +93,7 @@ static int frame_header_is_valid(AVCodecContext *avctx, const
uint8_t *buf,
FLACFrameInfo *fi)
{
BitstreamContext bc;
- bitstream_init(&bc, buf, MAX_FRAME_HEADER_SIZE * 8);
+ bitstream_init8(&bc, buf, MAX_FRAME_HEADER_SIZE);
return !ff_flac_decode_frame_header(avctx, &bc, fi, 127);
}
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 20fa7bc..252caab 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 1585965..ce25d3a 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 8c36b1a..77791ca 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 bfd4b42..fcf69ef 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 2ea3bbf..0cb5ba7 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 007cdb6..dab038f 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 d727cf9..0205faf 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 0d03e59..2afe853 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/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 836f74d..4a34dfd 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -188,7 +188,7 @@ static int read_huffman_tables(HYuvContext *s, const
uint8_t *src, int length)
BitstreamContext bc;
int i, ret;
- if ((ret = bitstream_init(&bc, src, length * 8)) < 0)
+ if ((ret = bitstream_init8(&bc, src, length)) < 0)
return ret;
for (i = 0; i < 3; i++) {
@@ -213,14 +213,14 @@ static int read_old_huffman_tables(HYuvContext *s)
BitstreamContext bc;
int i, ret;
- if ((ret = bitstream_init(&bc, classic_shift_luma,
- classic_shift_luma_table_size * 8)) < 0)
+ if ((ret = bitstream_init8(&bc, classic_shift_luma,
+ classic_shift_luma_table_size)) < 0)
return ret;
if ((ret = read_len_table(s->len[0], &bc)) < 0)
return ret;
- if ((ret = bitstream_init(&bc, classic_shift_chroma,
- classic_shift_chroma_table_size * 8)) < 0)
+ if ((ret = bitstream_init8(&bc, classic_shift_chroma,
+ classic_shift_chroma_table_size)) < 0)
return ret;
if ((ret = read_len_table(s->len[1], &bc)) < 0)
return ret;
@@ -533,8 +533,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame,
if ((unsigned) (buf_size - table_size) >= INT_MAX / 8)
return AVERROR_INVALIDDATA;
- if ((ret = bitstream_init(&s->bc, s->bitstream_buffer + table_size,
- (buf_size - table_size) * 8)) < 0)
+ if ((ret = bitstream_init8(&s->bc, s->bitstream_buffer + table_size,
+ buf_size - table_size)) < 0)
return ret;
fake_ystride = s->interlaced ? p->linesize[0] * 2 : p->linesize[0];
diff --git a/libavcodec/imc.c b/libavcodec/imc.c
index 01ab012..f9230eb 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 de2a9bb..811056d 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 1f35005..7fc16b3 100644
--- a/libavcodec/indeo3.c
+++ b/libavcodec/indeo3.c
@@ -859,7 +859,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 fab9f27..f5593d3 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 3627979..5847fdf 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 37a2770..5f5a825 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 d9667b7..95e6aba 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 ac6d9cd..4cd9051 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 48f85e1..f737b25 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/mjpegbdec.c b/libavcodec/mjpegbdec.c
index b1cb1b0..b65df66 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -67,7 +67,7 @@ read_header:
if (buf_end - buf_ptr >= 1 << 28)
return AVERROR_INVALIDDATA;
- bitstream_init(&hbc, buf_ptr, /* buf_size */ (buf_end - buf_ptr) * 8);
+ bitstream_init8(&hbc, buf_ptr, /* buf_size */ buf_end - buf_ptr);
bitstream_skip(&hbc, 32); /* reserved zeros */
@@ -88,7 +88,7 @@ read_header:
av_log(avctx, AV_LOG_DEBUG, "dqt offs: 0x%"PRIx32"\n", dqt_offs);
if (dqt_offs)
{
- bitstream_init(&s->bc, buf_ptr + dqt_offs, (buf_end - (buf_ptr +
dqt_offs)) * 8);
+ bitstream_init8(&s->bc, buf_ptr + dqt_offs, buf_end - (buf_ptr +
dqt_offs));
s->start_code = DQT;
if (ff_mjpeg_decode_dqt(s) < 0 &&
(avctx->err_recognition & AV_EF_EXPLODE))
@@ -99,7 +99,7 @@ read_header:
av_log(avctx, AV_LOG_DEBUG, "dht offs: 0x%"PRIx32"\n", dht_offs);
if (dht_offs)
{
- bitstream_init(&s->bc, buf_ptr + dht_offs, (buf_end - (buf_ptr +
dht_offs)) * 8);
+ bitstream_init8(&s->bc, buf_ptr + dht_offs, buf_end - (buf_ptr +
dht_offs));
s->start_code = DHT;
ff_mjpeg_decode_dht(s);
}
@@ -108,7 +108,7 @@ read_header:
av_log(avctx, AV_LOG_DEBUG, "sof offs: 0x%"PRIx32"\n", sof_offs);
if (sof_offs)
{
- bitstream_init(&s->bc, buf_ptr + sof_offs, (buf_end - (buf_ptr +
sof_offs)) * 8);
+ bitstream_init8(&s->bc, buf_ptr + sof_offs, buf_end - (buf_ptr +
sof_offs));
s->start_code = SOF0;
if (ff_mjpeg_decode_sof(s) < 0)
return -1;
@@ -120,8 +120,8 @@ read_header:
av_log(avctx, AV_LOG_DEBUG, "sod offs: 0x%"PRIx32"\n", sod_offs);
if (sos_offs)
{
- bitstream_init(&s->bc, buf_ptr + sos_offs,
- 8 * FFMIN(field_size, buf_end - buf_ptr - sos_offs));
+ bitstream_init8(&s->bc, buf_ptr + sos_offs,
+ FFMIN(field_size, buf_end - buf_ptr - sos_offs));
s->mjpb_skiptosod = sod_offs - sos_offs - bitstream_peek(&s->bc, 16);
s->start_code = SOS;
if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index daf234c..73e560e 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 4088916..a606213 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 333f18f..da4c141 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 10b0b68..75b53f3 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 cf621af..f55fd57 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/mpegaudiodec_template.c
b/libavcodec/mpegaudiodec_template.c
index 631e582..4050387 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1366,7 +1366,7 @@ static int mp_decode_layer3(MPADecodeContext *s)
memcpy(s->last_buf + s->last_buf_size, ptr, s->extrasize);
s->in_bc = s->bc;
- bitstream_init(&s->bc, s->last_buf, (s->last_buf_size + s->extrasize)
* 8);
+ bitstream_init8(&s->bc, s->last_buf, s->last_buf_size + s->extrasize);
s->last_buf_size <<= 3;
for (gr = 0; gr < nb_granules && (s->last_buf_size >> 3) <
main_data_begin; gr++) {
for (ch = 0; ch < s->nb_channels; ch++) {
@@ -1529,7 +1529,7 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT
**samples,
int i, nb_frames, ch, ret;
OUT_INT *samples_ptr;
- bitstream_init(&s->bc, buf + HEADER_SIZE, (buf_size - HEADER_SIZE) * 8);
+ bitstream_init8(&s->bc, buf + HEADER_SIZE, buf_size - HEADER_SIZE);
/* skip error protection field */
if (s->error_protection)
diff --git a/libavcodec/msgsmdec.c b/libavcodec/msgsmdec.c
index c26efa9..01ea95f 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 390872c..8d9af5f 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 9094756..3407238 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -196,7 +196,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);
buf = pcx_rle_decode(buf, buf_end,
scanline, bytes_per_scanline, compressed);
diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c
index c8e4d17..6f7b2d9 100644
--- a/libavcodec/proresdec.c
+++ b/libavcodec/proresdec.c
@@ -433,7 +433,7 @@ static int decode_slice_plane(ProresContext *ctx,
ProresThreadData *td,
memset(td->blocks, 0, 8 * 4 * 64 * sizeof(*td->blocks));
- bitstream_init(&bc, buf, data_size << 3);
+ bitstream_init8(&bc, buf, data_size);
decode_dc_coeffs(&bc, td->blocks, blocks_per_slice);
@@ -534,7 +534,7 @@ static void decode_alpha_plane(ProresContext *ctx,
ProresThreadData *td,
memset(td->blocks, 0, 8 * 4 * 64 * sizeof(*td->blocks));
- bitstream_init(&bc, buf, data_size << 3);
+ bitstream_init8(&bc, buf, data_size);
if (ctx->alpha_info == 2)
unpack_alpha(&bc, td->blocks, mbs_per_slice * 4 * 64, 16);
diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c
index 9d5e13a..83be57a 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 95575a6..2d6c206 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -1104,7 +1104,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;
@@ -1141,7 +1141,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 {
@@ -1251,7 +1251,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) {
@@ -1263,7 +1263,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);
@@ -1299,7 +1299,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)
@@ -1494,7 +1494,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 35ee697..05165bf 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 bc3fe29..c457d0c 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 027728e..2abf7c1 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 f33a852..9da2f08 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 d952266..e24d401 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 99884be..333451c 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 48e2126..6b9afae 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 d86428a..6081c72 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 2f96933..54d3903 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -206,7 +206,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);
@@ -324,7 +324,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 6355ad4..8981d95 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 f4ae507..0b74390 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/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c
index 12bf9cd..f8c41a9 100644
--- a/libavcodec/vaapi_mpeg2.c
+++ b/libavcodec/vaapi_mpeg2.c
@@ -108,7 +108,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx,
const uint8_t *buffer
uint32_t quantiser_scale_code, intra_slice_flag, macroblock_offset;
/* Determine macroblock_offset */
- bitstream_init(&bc, buffer, 8 * size);
+ bitstream_init8(&bc, buffer, size);
if (bitstream_read(&bc, 32) >> 8 != 1) /* start code */
return AVERROR_INVALIDDATA;
quantiser_scale_code = bitstream_read(&bc, 5);
diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index fef1090..75db27f 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/vc1dec.c b/libavcodec/vc1dec.c
index cfc3716..f2e1b2c 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -647,8 +647,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void
*data,
goto err;
buf_size3 = vc1_unescape_buffer(start + 4, size,
slices[n_slices].buf);
- bitstream_init(&slices[n_slices].bc, slices[n_slices].buf,
- buf_size3 << 3);
+ bitstream_init8(&slices[n_slices].bc,
slices[n_slices].buf, buf_size3);
/* assuming that the field marker is at the exact middle,
hope it's correct */
slices[n_slices].mby_start = s->mb_height >> 1;
@@ -672,8 +671,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void
*data,
goto err;
buf_size3 = vc1_unescape_buffer(start + 4, size,
slices[n_slices].buf);
- bitstream_init(&slices[n_slices].bc, slices[n_slices].buf,
- buf_size3 << 3);
+ bitstream_init8(&slices[n_slices].bc,
slices[n_slices].buf, buf_size3);
slices[n_slices].mby_start =
bitstream_read(&slices[n_slices].bc, 9);
n_slices++;
break;
@@ -697,8 +695,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, void
*data,
if (!slices[n_slices].buf)
goto err;
buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size -
divider - 4, slices[n_slices].buf);
- bitstream_init(&slices[n_slices].bc, slices[n_slices].buf,
- buf_size3 << 3);
+ bitstream_init8(&slices[n_slices].bc, slices[n_slices].buf,
buf_size3);
slices[n_slices].mby_start = s->mb_height >> 1;
n_slices1 = n_slices - 1;
n_slices++;
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index 881afd1..54eb59e 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -103,7 +103,7 @@ static int parse_setup_header(AVVorbisParseContext *s,
}
for (i = 0; i < buf_size; i++)
rev_buf[i] = buf[buf_size - 1 - i];
- bitstream_init(&bc, rev_buf, buf_size * 8);
+ bitstream_init8(&bc, rev_buf, buf_size);
got_framing_bit = 0;
while (bitstream_bits_left(&bc) > 97) {
@@ -169,7 +169,7 @@ static int parse_setup_header(AVVorbisParseContext *s,
/* The previous window flag is the next bit after the mode */
s->prev_mask = (s->mode_mask | 0x1) + 1;
- bitstream_init(&bc, rev_buf, buf_size * 8);
+ bitstream_init8(&bc, rev_buf, buf_size);
bitstream_skip(&bc, got_framing_bit);
for (i = mode_count - 1; i >= 0; i--) {
bitstream_skip(&bc, 40);
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index 3fff3fc..5221860 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1029,7 +1029,7 @@ static av_cold int vorbis_decode_init(AVCodecContext
*avctx)
return ret;
}
- bitstream_init(bc, header_start[0], header_len[0] * 8);
+ bitstream_init8(bc, header_start[0], header_len[0]);
hdr_type = bitstream_read(bc, 8);
if (hdr_type != 1) {
av_log(avctx, AV_LOG_ERROR, "First header is not the id header.\n");
@@ -1041,7 +1041,7 @@ static av_cold int vorbis_decode_init(AVCodecContext
*avctx)
return ret;
}
- bitstream_init(bc, header_start[2], header_len[2] * 8);
+ bitstream_init8(bc, header_start[2], header_len[2]);
hdr_type = bitstream_read(bc, 8);
if (hdr_type != 5) {
av_log(avctx, AV_LOG_ERROR, "Third header is not the setup header.\n");
@@ -1718,7 +1718,7 @@ static int vorbis_decode_frame(AVCodecContext *avctx,
void *data,
}
}
- bitstream_init(bc, buf, buf_size * 8);
+ bitstream_init8(bc, buf, buf_size);
if ((len = vorbis_parse_audio_packet(vc, channel_ptrs)) <= 0)
return len;
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index e3232c1..5d5aad6 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1989,7 +1989,7 @@ static int vp3_decode_frame(AVCodecContext *avctx,
BitstreamContext bc;
int i, ret;
- bitstream_init(&bc, buf, buf_size * 8);
+ bitstream_init8(&bc, buf, buf_size);
if (s->theora && bitstream_read_bit(&bc)) {
av_log(avctx, AV_LOG_ERROR,
@@ -2446,7 +2446,7 @@ static av_cold int theora_decode_init(AVCodecContext
*avctx)
for (i = 0; i < 3; i++) {
if (header_len[i] <= 0)
continue;
- bitstream_init(&bc, header_start[i], header_len[i] * 8);
+ bitstream_init8(&bc, header_start[i], header_len[i]);
ptype = bitstream_read(&bc, 8);
diff --git a/libavcodec/vp6.c b/libavcodec/vp6.c
index c94bbd4..8f09a6a 100644
--- a/libavcodec/vp6.c
+++ b/libavcodec/vp6.c
@@ -163,7 +163,7 @@ static int vp6_parse_header(VP56Context *s, const uint8_t
*buf, int buf_size,
}
if (s->use_huffman) {
s->parse_coeff = vp6_parse_coeff_huffman;
- bitstream_init(&s->bc, buf, buf_size << 3);
+ bitstream_init8(&s->bc, buf, buf_size);
} else {
ff_vp56_init_range_decoder(&s->cc, buf, buf_size);
s->ccp = &s->cc;
diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index a6ab52b..4548e5f 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/wmadec.c b/libavcodec/wmadec.c
index 3cb4e61..fcbac93 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -812,7 +812,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
void *data,
}
buf_size = avctx->block_align;
- bitstream_init(&s->bc, buf, buf_size * 8);
+ bitstream_init8(&s->bc, buf, buf_size);
if (s->use_bit_reservoir) {
/* read super frame header */
@@ -872,7 +872,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
void *data,
pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3;
if (pos >= MAX_CODED_SUPERFRAME_SIZE * 8 || pos > buf_size * 8)
return AVERROR_INVALIDDATA;
- bitstream_init(&s->bc, buf + (pos >> 3), (buf_size - (pos >> 3)) * 8);
+ bitstream_init8(&s->bc, buf + (pos >> 3), buf_size - (pos >> 3));
len = pos & 7;
if (len > 0)
bitstream_skip(&s->bc, len);
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 6c3a5f7..080999b 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -400,7 +400,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
for (n = 0; n < s->lsps; n++)
s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
- bitstream_init(&s->bc, ctx->extradata + 22, (ctx->extradata_size - 22) <<
3);
+ bitstream_init8(&s->bc, ctx->extradata + 22, ctx->extradata_size - 22);
if (decode_vbmtree(&s->bc, s->vbm_tree) < 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid VBM tree; broken extradata?\n");
return AVERROR_INVALIDDATA;
@@ -1964,7 +1964,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx,
void *data,
*got_frame_ptr = 0;
return 0;
}
- bitstream_init(&s->bc, avpkt->data, size << 3);
+ bitstream_init8(&s->bc, avpkt->data, size);
/* size == ctx->block_align is used to indicate whether we are dealing with
* a new packet or a packet of which we already read the packet header
@@ -2008,7 +2008,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx,
void *data,
return cnt >> 3;
} else if ((s->sframe_cache_size = pos) > 0) {
/* rewind bit reader to start of last (incomplete) superframe... */
- bitstream_init(bc, avpkt->data, size << 3);
+ bitstream_init8(bc, avpkt->data, size);
bitstream_skip(bc, (size << 3) - pos);
assert(bitstream_bits_left(bc) == pos);
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index 80d66ae..e973f7e 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 33149e5..5bb4f16 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 a07f94c..635067c 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/adtsenc.c b/libavformat/adtsenc.c
index 639c39e..ea90626 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -46,7 +46,7 @@ static int adts_decode_extradata(AVFormatContext *s,
ADTSContext *adts, uint8_t
MPEG4AudioConfig m4ac;
int off;
- bitstream_init(&bc, buf, size * 8);
+ bitstream_init8(&bc, buf, size);
off = avpriv_mpeg4audio_get_config(&m4ac, buf, size * 8, 1);
if (off < 0)
return off;
diff --git a/libavformat/h261dec.c b/libavformat/h261dec.c
index d8a2cec..5420294 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 1a88cd2..a8fcb4a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2057,7 +2057,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 d37cf8d..58a17bd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -251,7 +251,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);
@@ -469,7 +469,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 6e12fca..311480d 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 90b1495..0946a3b 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 da47a0c..d9992fa 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 da5ff59..825e4f1 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 3f1c9d5..f0dfafb 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 8542404..7e649ce 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 2c0f818..e6c586f 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 750a52b..3b3479a 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 */
--
2.7.3
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel