Commit 5fc32c27 authored by Alex Beregszaszi's avatar Alex Beregszaszi

use get_bits1(..) instead get_bits(.., 1)

Originally committed as revision 9999 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b6c748ed
......@@ -489,12 +489,12 @@ static int alac_decode_frame(AVCodecContext *avctx,
get_bits(&alac->gb, 12); /* unknown, skip 12 bits */
/* the output sample size is stored soon */
hassize = get_bits(&alac->gb, 1);
hassize = get_bits1(&alac->gb);
wasted_bytes = get_bits(&alac->gb, 2); /* unknown ? */
/* whether the frame is compressed */
isnotcompressed = get_bits(&alac->gb, 1);
isnotcompressed = get_bits1(&alac->gb);
if (hassize) {
/* now read the number of samples as a 32bit integer */
......
......@@ -363,7 +363,7 @@ static int decodeSpectrum (GetBitContext *gb, float *pOut)
float SF;
numSubbands = get_bits(gb, 5); // number of coded subbands
codingMode = get_bits(gb, 1); // coding Mode: 0 - VLC/ 1-CLC
codingMode = get_bits1(gb); // coding Mode: 0 - VLC/ 1-CLC
/* Get the VLC selector table for the subbands, 0 means not coded. */
for (cnt = 0; cnt <= numSubbands; cnt++)
......@@ -811,7 +811,7 @@ static int decodeFrame(ATRAC3Context *q, uint8_t* databuf)
/* Fill the Weighting coeffs delay buffer */
memmove(q->weighting_delay,&(q->weighting_delay[2]),4*sizeof(int));
q->weighting_delay[4] = get_bits(&q->gb,1);
q->weighting_delay[4] = get_bits1(&q->gb);
q->weighting_delay[5] = get_bits(&q->gb,3);
for (i = 0; i < 4; i++) {
......
......@@ -455,7 +455,7 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
pixels_read++;
} else {
bits = get_bits(&gb, 1);
bits = get_bits1(&gb);
if (bits == 1) {
run_length = get_bits(&gb, 3) + 3;
bits = get_bits(&gb, 2);
......@@ -471,7 +471,7 @@ static int dvbsub_read_2bit_string(uint8_t *destbuf, int dbuf_len,
}
}
} else {
bits = get_bits(&gb, 1);
bits = get_bits1(&gb);
if (bits == 0) {
bits = get_bits(&gb, 2);
if (bits == 2) {
......@@ -560,7 +560,7 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
}
pixels_read++;
} else {
bits = get_bits(&gb, 1);
bits = get_bits1(&gb);
if (bits == 0) {
run_length = get_bits(&gb, 3);
......@@ -581,7 +581,7 @@ static int dvbsub_read_4bit_string(uint8_t *destbuf, int dbuf_len,
pixels_read++;
}
} else {
bits = get_bits(&gb, 1);
bits = get_bits1(&gb);
if (bits == 0) {
run_length = get_bits(&gb, 2) + 4;
bits = get_bits(&gb, 4);
......
......@@ -183,7 +183,7 @@ static int metadata_parse(FLACContext *s)
av_log(s->avctx, AV_LOG_DEBUG, "STREAM HEADER\n");
do {
metadata_last = get_bits(&s->gb, 1);
metadata_last = get_bits1(&s->gb);
metadata_type = get_bits(&s->gb, 7);
metadata_size = get_bits_long(&s->gb, 24);
......
......@@ -5077,7 +5077,7 @@ int h263_decode_picture_header(MpegEncContext *s)
format = get_bits(&s->gb, 3);
dprintf(s->avctx, "ufep=1, format: %d\n", format);
s->custom_pcf= get_bits1(&s->gb);
s->umvplus = get_bits(&s->gb, 1); /* Unrestricted Motion Vector */
s->umvplus = get_bits1(&s->gb); /* Unrestricted Motion Vector */
if (get_bits1(&s->gb) != 0) {
av_log(s->avctx, AV_LOG_ERROR, "Syntax-based Arithmetic Coding (SAC) not supported\n");
}
......
......@@ -454,7 +454,7 @@ static void imc_get_skip_coeff(IMCContext* q) {
q->skipFlagBits[i] = band_tab[i+1] - band_tab[i];
for(j = band_tab[i]; j < band_tab[i+1]; j++) {
if ((q->skipFlags[j] = get_bits(&q->gb,1)))
if ((q->skipFlags[j] = get_bits1(&q->gb)))
q->skipFlagCount[i]++;
}
} else {
......@@ -485,7 +485,7 @@ static void imc_get_skip_coeff(IMCContext* q) {
if (j < band_tab[i+1]) {
q->skipFlagBits[i]++;
if ((q->skipFlags[j] = get_bits(&q->gb,1)))
if ((q->skipFlags[j] = get_bits1(&q->gb)))
q->skipFlagCount[i]++;
}
}
......
......@@ -2002,14 +2002,14 @@ static int mp_decode_layer3(MPADecodeContext *s)
g->scalefac_compress = get_bits(&s->gb, 9);
else
g->scalefac_compress = get_bits(&s->gb, 4);
blocksplit_flag = get_bits(&s->gb, 1);
blocksplit_flag = get_bits1(&s->gb);
if (blocksplit_flag) {
g->block_type = get_bits(&s->gb, 2);
if (g->block_type == 0){
av_log(NULL, AV_LOG_ERROR, "invalid block type\n");
return -1;
}
g->switch_point = get_bits(&s->gb, 1);
g->switch_point = get_bits1(&s->gb);
for(i=0;i<2;i++)
g->table_select[i] = get_bits(&s->gb, 5);
for(i=0;i<3;i++)
......@@ -2081,9 +2081,9 @@ static int mp_decode_layer3(MPADecodeContext *s)
g->preflag = 0;
if (!s->lsf)
g->preflag = get_bits(&s->gb, 1);
g->scalefac_scale = get_bits(&s->gb, 1);
g->count1table_select = get_bits(&s->gb, 1);
g->preflag = get_bits1(&s->gb);
g->scalefac_scale = get_bits1(&s->gb);
g->count1table_select = get_bits1(&s->gb);
dprintf(s->avctx, "block_type=%d switch_point=%d\n",
g->block_type, g->switch_point);
}
......
......@@ -195,7 +195,7 @@ int rv_decode_dc(MpegEncContext *s, int n)
} else if (code == 0x7d) {
code = -128 + get_bits(&s->gb, 7);
} else if (code == 0x7e) {
if (get_bits(&s->gb, 1) == 0)
if (get_bits1(&s->gb) == 0)
code = (int8_t)(get_bits(&s->gb, 8) + 1);
else
code = (int8_t)(get_bits(&s->gb, 8));
......@@ -312,15 +312,15 @@ static int rv10_decode_picture_header(MpegEncContext *s)
int mb_count, pb_frame, marker, unk, mb_xy;
//printf("ff:%d\n", full_frame);
marker = get_bits(&s->gb, 1);
marker = get_bits1(&s->gb);
if (get_bits(&s->gb, 1))
if (get_bits1(&s->gb))
s->pict_type = P_TYPE;
else
s->pict_type = I_TYPE;
//printf("h:%X ver:%d\n",h,s->rv10_version);
if(!marker) av_log(s->avctx, AV_LOG_ERROR, "marker missing\n");
pb_frame = get_bits(&s->gb, 1);
pb_frame = get_bits1(&s->gb);
#ifdef DEBUG
av_log(s->avctx, AV_LOG_DEBUG, "pict_type=%d pb_frame=%d\n", s->pict_type, pb_frame);
......@@ -416,7 +416,7 @@ static int rv20_decode_picture_header(MpegEncContext *s)
return -1;
}
if (get_bits(&s->gb, 1)){
if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit set\n");
return -1;
}
......@@ -427,7 +427,7 @@ static int rv20_decode_picture_header(MpegEncContext *s)
return -1;
}
if(s->avctx->sub_id == 0x30203002){
if (get_bits(&s->gb, 1)){
if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit2 set\n");
return -1;
}
......@@ -437,7 +437,7 @@ static int rv20_decode_picture_header(MpegEncContext *s)
int f, new_w, new_h;
int v= s->avctx->extradata_size >= 4 ? 7&((uint8_t*)s->avctx->extradata)[1] : 0;
if (get_bits(&s->gb, 1)){
if (get_bits1(&s->gb)){
av_log(s->avctx, AV_LOG_ERROR, "unknown bit3 set\n");
// return -1;
}
......
......@@ -290,7 +290,7 @@ static int decode_header_trees(SmackVContext *smk) {
} else {
smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size);
}
if(!get_bits(&gb, 1)) {
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
smk->mclr_tbl = av_malloc(sizeof(int) * 2);
smk->mclr_tbl[0] = 0;
......@@ -298,7 +298,7 @@ static int decode_header_trees(SmackVContext *smk) {
} else {
smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size);
}
if(!get_bits(&gb, 1)) {
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
smk->full_tbl = av_malloc(sizeof(int) * 2);
smk->full_tbl[0] = 0;
......@@ -306,7 +306,7 @@ static int decode_header_trees(SmackVContext *smk) {
} else {
smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size);
}
if(!get_bits(&gb, 1)) {
if(!get_bits1(&gb)) {
av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
smk->type_tbl = av_malloc(sizeof(int) * 2);
smk->type_tbl[0] = 0;
......
......@@ -137,7 +137,7 @@ static const uint8_t string_table[256] = {
break;\
}\
/* divide block if next bit set */\
if (get_bits (bitbuf, 1) == 0)\
if (get_bits1 (bitbuf) == 0)\
break;\
/* add child nodes */\
list[n++] = list[i];\
......@@ -617,7 +617,7 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
}
/* unknown fields */
if (get_bits (bitbuf, 1) == 1) {
if (get_bits1 (bitbuf) == 1) {
skip_bits1 (bitbuf); /* use packet checksum if (1) */
skip_bits1 (bitbuf); /* component checksums after image data if (1) */
......@@ -625,13 +625,13 @@ static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
return -1;
}
if (get_bits (bitbuf, 1) == 1) {
if (get_bits1 (bitbuf) == 1) {
skip_bits1 (bitbuf);
skip_bits (bitbuf, 4);
skip_bits1 (bitbuf);
skip_bits (bitbuf, 2);
while (get_bits (bitbuf, 1) == 1) {
while (get_bits1 (bitbuf) == 1) {
skip_bits (bitbuf, 8);
}
}
......
......@@ -465,9 +465,9 @@ static int svq3_decode_mb (H264Context *h, unsigned int mb_type) {
mb_type = MB_TYPE_16x16;
}
} else if (mb_type < 8) { /* INTER */
if (h->thirdpel_flag && h->halfpel_flag == !get_bits (&s->gb, 1)) {
if (h->thirdpel_flag && h->halfpel_flag == !get_bits1 (&s->gb)) {
mode = THIRDPEL_MODE;
} else if (h->halfpel_flag && h->thirdpel_flag == !get_bits (&s->gb, 1)) {
} else if (h->halfpel_flag && h->thirdpel_flag == !get_bits1 (&s->gb)) {
mode = HALFPEL_MODE;
} else {
mode = FULLPEL_MODE;
......
This diff is collapsed.
......@@ -791,7 +791,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) {
for(i=0;i<vc->mode_count;++i) {
vorbis_mode *mode_setup=&vc->modes[i];
mode_setup->blockflag=get_bits(gb, 1);
mode_setup->blockflag=get_bits1(gb);
mode_setup->windowtype=get_bits(gb, 16); //FIXME check
mode_setup->transformtype=get_bits(gb, 16); //FIXME check
mode_setup->mapping=get_bits(gb, 8); //FIXME check
......
......@@ -686,7 +686,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
} else {
/* unpack the list of partially-coded superblocks */
bit = get_bits(gb, 1);
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
......@@ -722,7 +722,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
current_superblock = 0;
current_run = 0;
bit = get_bits(gb, 1);
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
......@@ -753,7 +753,7 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb)
if (decode_partial_blocks) {
current_run = 0;
bit = get_bits(gb, 1);
bit = get_bits1(gb);
/* toggle the bit because as soon as the first run length is
* fetched the bit will be toggled again */
bit ^= 1;
......@@ -979,7 +979,7 @@ static int unpack_vectors(Vp3DecodeContext *s, GetBitContext *gb)
memset(motion_y, 0, 6 * sizeof(int));
/* coding mode 0 is the VLC scheme; 1 is the fixed code scheme */
coding_mode = get_bits(gb, 1);
coding_mode = get_bits1(gb);
debug_vectors(" using %s scheme for unpacking motion vectors\n",
(coding_mode == 0) ? "VLC" : "fixed-length");
......@@ -2337,7 +2337,7 @@ static int read_huffman_tree(AVCodecContext *avctx, GetBitContext *gb)
{
Vp3DecodeContext *s = avctx->priv_data;
if (get_bits(gb, 1)) {
if (get_bits1(gb)) {
int token;
if (s->entries >= 32) { /* overflow */
av_log(avctx, AV_LOG_ERROR, "huffman tree overflow\n");
......@@ -2488,10 +2488,10 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
for (plane = 0; plane <= 2; plane++) {
int newqr= 1;
if (inter || plane > 0)
newqr = get_bits(gb, 1);
newqr = get_bits1(gb);
if (!newqr) {
int qtj, plj;
if(inter && get_bits(gb, 1)){
if(inter && get_bits1(gb)){
qtj = 0;
plj = plane;
}else{
......@@ -2532,7 +2532,7 @@ static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
for (s->hti = 0; s->hti < 80; s->hti++) {
s->entries = 0;
s->huff_code_size = 1;
if (!get_bits(gb, 1)) {
if (!get_bits1(gb)) {
s->hbits = 0;
read_huffman_tree(avctx, gb);
s->hbits = 1;
......
......@@ -393,11 +393,11 @@ static int wma_decode_block(WMACodecContext *s)
return -1;
if (s->nb_channels == 2) {
s->ms_stereo = get_bits(&s->gb, 1);
s->ms_stereo = get_bits1(&s->gb);
}
v = 0;
for(ch = 0; ch < s->nb_channels; ch++) {
a = get_bits(&s->gb, 1);
a = get_bits1(&s->gb);
s->channel_coded[ch] = a;
v |= a;
}
......@@ -433,7 +433,7 @@ static int wma_decode_block(WMACodecContext *s)
int i, n, a;
n = s->exponent_high_sizes[bsize];
for(i=0;i<n;i++) {
a = get_bits(&s->gb, 1);
a = get_bits1(&s->gb);
s->high_band_coded[ch][i] = a;
/* if noise coding, the coefficients are not transmitted */
if (a)
......@@ -466,7 +466,7 @@ static int wma_decode_block(WMACodecContext *s)
/* exponents can be reused in short blocks. */
if ((s->block_len_bits == s->frame_len_bits) ||
get_bits(&s->gb, 1)) {
get_bits1(&s->gb)) {
for(ch = 0; ch < s->nb_channels; ch++) {
if (s->channel_coded[ch]) {
if (s->use_exp_vlc) {
......@@ -516,7 +516,7 @@ static int wma_decode_block(WMACodecContext *s)
run = run_table[code];
level = level_table[code];
}
sign = get_bits(&s->gb, 1);
sign = get_bits1(&s->gb);
if (!sign)
level = -level;
ptr += run;
......
......@@ -363,7 +363,7 @@ return -1;
if(s->picture_number==0)
decode_ext_header(w);
s->pict_type = get_bits(&s->gb, 1) + 1;
s->pict_type = get_bits1(&s->gb) + 1;
if(s->pict_type == I_TYPE){
code = get_bits(&s->gb, 7);
av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
......
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