use skip_bits where appropriate

Originally committed as revision 10005 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Alex Beregszaszi 18 years ago
parent 7ae7300ee3
commit 3a5729eae1
  1. 8
      libavcodec/cavsdec.c
  2. 28
      libavcodec/svq3.c
  3. 16
      libavcodec/vc1.c

@ -432,7 +432,7 @@ static inline void check_for_slice(AVSContext *h) {
int align;
align = (-get_bits_count(gb)) & 7;
if((show_bits_long(gb,24+align) & 0xFFFFFF) == 0x000001) {
get_bits_long(gb,24+align);
skip_bits_long(gb,24+align);
h->stc = get_bits(gb,8);
decode_slice_header(h,gb);
}
@ -455,7 +455,7 @@ static int decode_pic(AVSContext *h) {
return -1;
ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
}
get_bits(&s->gb,16);//bbv_dwlay
skip_bits(&s->gb,16);//bbv_dwlay
if(h->stc == PIC_PB_START_CODE) {
h->pic_type = get_bits(&s->gb,2) + FF_I_TYPE;
if(h->pic_type > FF_B_TYPE) {
@ -469,7 +469,7 @@ static int decode_pic(AVSContext *h) {
} else {
h->pic_type = FF_I_TYPE;
if(get_bits1(&s->gb))
get_bits(&s->gb,16);//time_code
skip_bits(&s->gb,16);//time_code
}
/* release last B frame */
if(h->picture.data[0])
@ -501,7 +501,7 @@ static int decode_pic(AVSContext *h) {
if(h->progressive)
h->pic_structure = 1;
else if(!(h->pic_structure = get_bits1(&s->gb) && (h->stc == PIC_PB_START_CODE)) )
get_bits1(&s->gb); //advanced_pred_mode_disable
skip_bits1(&s->gb); //advanced_pred_mode_disable
skip_bits1(&s->gb); //top_field_first
skip_bits1(&s->gb); //repeat_first_field
h->qp_fixed = get_bits1(&s->gb);

@ -748,7 +748,7 @@ static int svq3_decode_slice_header (H264Context *h) {
i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));
s->mb_skip_run = get_bits (&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));
} else {
get_bits1 (&s->gb);
skip_bits1 (&s->gb);
s->mb_skip_run = 0;
}
@ -757,17 +757,17 @@ static int svq3_decode_slice_header (H264Context *h) {
s->adaptive_quant = get_bits1 (&s->gb);
/* unknown fields */
get_bits1 (&s->gb);
skip_bits1 (&s->gb);
if (h->unknown_svq3_flag) {
get_bits1 (&s->gb);
skip_bits1 (&s->gb);
}
get_bits1 (&s->gb);
get_bits (&s->gb, 2);
skip_bits1 (&s->gb);
skip_bits (&s->gb, 2);
while (get_bits1 (&s->gb)) {
get_bits (&s->gb, 8);
skip_bits (&s->gb, 8);
}
/* reset intra predictors and invalidate motion vector references */
@ -834,26 +834,26 @@ static int svq3_decode_frame (AVCodecContext *avctx,
/* 'frame size code' and optional 'width, height' */
if (get_bits (&gb, 3) == 7) {
get_bits (&gb, 12);
get_bits (&gb, 12);
skip_bits (&gb, 12);
skip_bits (&gb, 12);
}
h->halfpel_flag = get_bits1 (&gb);
h->thirdpel_flag = get_bits1 (&gb);
/* unknown fields */
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
get_bits1 (&gb);
skip_bits1 (&gb);
skip_bits1 (&gb);
skip_bits1 (&gb);
skip_bits1 (&gb);
s->low_delay = get_bits1 (&gb);
/* unknown field */
get_bits1 (&gb);
skip_bits1 (&gb);
while (get_bits1 (&gb)) {
get_bits (&gb, 8);
skip_bits (&gb, 8);
}
h->unknown_svq3_flag = get_bits1 (&gb);

@ -913,7 +913,7 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
v->interlace = get_bits1(gb);
v->tfcntrflag = get_bits1(gb);
v->finterpflag = get_bits1(gb);
get_bits1(gb); // reserved
skip_bits1(gb); // reserved
v->s.h_edge_pos = v->s.avctx->coded_width;
v->s.v_edge_pos = v->s.avctx->coded_height;
@ -975,11 +975,11 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
if(v->hrd_param_flag) {
int i;
v->hrd_num_leaky_buckets = get_bits(gb, 5);
get_bits(gb, 4); //bitrate exponent
get_bits(gb, 4); //buffer size exponent
skip_bits(gb, 4); //bitrate exponent
skip_bits(gb, 4); //buffer size exponent
for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
get_bits(gb, 16); //hrd_rate[n]
get_bits(gb, 16); //hrd_buffer[n]
skip_bits(gb, 16); //hrd_rate[n]
skip_bits(gb, 16); //hrd_buffer[n]
}
}
return 0;
@ -1005,7 +1005,7 @@ static int decode_entry_point(AVCodecContext *avctx, GetBitContext *gb)
if(v->hrd_param_flag){
for(i = 0; i < v->hrd_num_leaky_buckets; i++) {
get_bits(gb, 8); //hrd_full[n]
skip_bits(gb, 8); //hrd_full[n]
}
}
@ -1059,7 +1059,7 @@ static int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb)
}
}
if(v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE)
get_bits(gb, 7); // skip buffer fullness
skip_bits(gb, 7); // skip buffer fullness
/* calculate RND */
if(v->s.pict_type == I_TYPE || v->s.pict_type == BI_TYPE)
@ -1278,7 +1278,7 @@ static int vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb)
return 0;
}
if(v->tfcntrflag)
get_bits(gb, 8);
skip_bits(gb, 8);
if(v->broadcast) {
if(!v->interlace || v->psf) {
v->rptfrm = get_bits(gb, 2);

Loading…
Cancel
Save