Commit a15d904a authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec: Replace get_bits_long() by get_bits() where possible

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 9a8471e3
......@@ -493,7 +493,7 @@ int ff_bgmc_decode_init(GetBitContext *gb, unsigned int *h,
*h = TOP_VALUE;
*l = 0;
*v = get_bits_long(gb, VALUE_BITS);
*v = get_bits(gb, VALUE_BITS);
return 0;
}
......
......@@ -153,7 +153,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
static float get_float(GetBitContext *gb)
{
int power = get_bits(gb, 5);
float f = ldexpf(get_bits_long(gb, 23), power - 23);
float f = ldexpf(get_bits(gb, 23), power - 23);
if (get_bits1(gb))
f = -f;
return f;
......
......@@ -252,7 +252,7 @@ static int escape124_decode_frame(AVCodecContext *avctx,
if (i == 2) {
// This codebook can be cut off at places other than
// powers of 2, leaving some of the entries undefined.
cb_size = get_bits_long(&gb, 20);
cb_size = get_bits(&gb, 20);
if (!cb_size) {
av_log(avctx, AV_LOG_ERROR, "Invalid codebook size 0.\n");
return AVERROR_INVALIDDATA;
......
......@@ -217,9 +217,9 @@ int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
}
skip_bits(&gb, 24); /* skip min frame size */
s->max_framesize = get_bits_long(&gb, 24);
s->max_framesize = get_bits(&gb, 24);
s->samplerate = get_bits_long(&gb, 20);
s->samplerate = get_bits(&gb, 20);
s->channels = get_bits(&gb, 3) + 1;
s->bps = get_bits(&gb, 5) + 1;
......
......@@ -30,7 +30,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
int format, width, height;
/* picture header */
if (get_bits_long(&s->gb, 17) != 1) {
if (get_bits(&s->gb, 17) != 1) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return AVERROR_INVALIDDATA;
}
......
......@@ -76,8 +76,8 @@ static int decode_nal_sei_mastering_display_info(HEVCSEIMasteringDisplay *s, Get
static int decode_nal_sei_content_light_info(HEVCSEIContentLight *s, GetBitContext *gb)
{
// Max and average light levels
s->max_content_light_level = get_bits_long(gb, 16);
s->max_pic_average_light_level = get_bits_long(gb, 16);
s->max_content_light_level = get_bits(gb, 16);
s->max_pic_average_light_level = get_bits(gb, 16);
// As this SEI message comes before the first frame that references it,
// initialize the flag to 2 and decrement on IRAP access unit so it
// persists for the coded video sequence (e.g., between two IRAPs)
......
......@@ -348,7 +348,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
if (ctx->frame_type != FRAMETYPE_NULL) {
ctx->frame_flags = get_bits(&ctx->gb, 8);
ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits_long(&ctx->gb, 24) : 0;
ctx->pic_hdr_size = (ctx->frame_flags & 1) ? get_bits(&ctx->gb, 24) : 0;
ctx->checksum = (ctx->frame_flags & 0x10) ? get_bits(&ctx->gb, 16) : 0;
......@@ -392,7 +392,7 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
return 0;
}
band->data_size = (ctx->frame_flags & 0x80) ? get_bits_long(&ctx->gb, 24) : 0;
band->data_size = (ctx->frame_flags & 0x80) ? get_bits(&ctx->gb, 24) : 0;
band->inherit_mv = band_flags & 2;
band->inherit_qdelta = band_flags & 8;
......
......@@ -33,7 +33,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s)
}
/* picture header */
if (get_bits_long(&s->gb, 22) != 0x20) {
if (get_bits(&s->gb, 22) != 0x20) {
av_log(s->avctx, AV_LOG_ERROR, "Bad picture start code\n");
return -1;
}
......
......@@ -476,7 +476,7 @@ static int ivi_dec_tile_data_size(GetBitContext *gb)
if (get_bits1(gb)) {
len = get_bits(gb, 8);
if (len == 255)
len = get_bits_long(gb, 24);
len = get_bits(gb, 24);
}
/* align the bitstream reader on the byte boundary */
......
......@@ -2049,7 +2049,7 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
unsigned nummarkers;
id = get_bits_long(&s->gb, 32);
id2 = get_bits_long(&s->gb, 24);
id2 = get_bits(&s->gb, 24);
len -= 7;
if (id != AV_RB32("PROF") || id2 != AV_RB24("ILE")) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid ICC_PROFILE header in APP2\n");
......
......@@ -102,7 +102,7 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
return AVERROR_INVALIDDATA;
}
if (get_bits_long(gb, 24) != 0xf8726f) /* Sync words */
if (get_bits(gb, 24) != 0xf8726f) /* Sync words */
return AVERROR_INVALIDDATA;
mh->stream_type = get_bits(gb, 8);
......
......@@ -1001,7 +1001,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx)
if (s->pict_type == AV_PICTURE_TYPE_I) {
while (show_bits(&s->gb, 9) == 1)
skip_bits(&s->gb, 9);
if (get_bits_long(&s->gb, 19) != DC_MARKER) {
if (get_bits(&s->gb, 19) != DC_MARKER) {
av_log(s->avctx, AV_LOG_ERROR,
"marker missing after first I partition at %d %d\n",
s->mb_x, s->mb_y);
......
......@@ -155,7 +155,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
huff.val_bits = get_bits(&ctx->gb, 5);
huff.max_bits = get_bits(&ctx->gb, 5);
huff.min_bits = get_bits(&ctx->gb, 5);
huff.nodes = get_bits_long(&ctx->gb, 17);
huff.nodes = get_bits(&ctx->gb, 17);
huff.num = 0;
/* check for correct codes parameters */
......
......@@ -2967,7 +2967,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
AVRational fps, aspect;
s->theora_header = 0;
s->theora = get_bits_long(gb, 24);
s->theora = get_bits(gb, 24);
av_log(avctx, AV_LOG_DEBUG, "Theora bitstream version %X\n", s->theora);
if (!s->theora) {
s->theora = 1;
......@@ -2988,8 +2988,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
s->height = get_bits(gb, 16) << 4;
if (s->theora >= 0x030200) {
visible_width = get_bits_long(gb, 24);
visible_height = get_bits_long(gb, 24);
visible_width = get_bits(gb, 24);
visible_height = get_bits(gb, 24);
offset_x = get_bits(gb, 8); /* offset x */
offset_y = get_bits(gb, 8); /* offset y, from bottom */
......@@ -3017,8 +3017,8 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
fps.den, fps.num, 1 << 30);
}
aspect.num = get_bits_long(gb, 24);
aspect.den = get_bits_long(gb, 24);
aspect.num = get_bits(gb, 24);
aspect.den = get_bits(gb, 24);
if (aspect.num && aspect.den) {
av_reduce(&avctx->sample_aspect_ratio.num,
&avctx->sample_aspect_ratio.den,
......
......@@ -514,7 +514,7 @@ static int decode_frame_header(AVCodecContext *avctx,
s->s.h.use_last_frame_mvs = !s->s.h.errorres && !last_invisible;
if (s->s.h.keyframe) {
if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
if (get_bits(&s->gb, 24) != VP9_SYNCCODE) { // synccode
av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
return AVERROR_INVALIDDATA;
}
......@@ -530,7 +530,7 @@ static int decode_frame_header(AVCodecContext *avctx,
s->s.h.intraonly = s->s.h.invisible ? get_bits1(&s->gb) : 0;
s->s.h.resetctx = s->s.h.errorres ? 0 : get_bits(&s->gb, 2);
if (s->s.h.intraonly) {
if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
if (get_bits(&s->gb, 24) != VP9_SYNCCODE) { // synccode
av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
return AVERROR_INVALIDDATA;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment