comparison h263.c @ 10535:95f3daa991a2 libavcodec

Use get_bits_left() instead of size_in_bits - get_bits_count().
author rbultje
date Mon, 16 Nov 2009 17:42:43 +0000
parents c78fd9154378
children 703cfed31320
comparison
equal deleted inserted replaced
10534:4cd2ef16fb63 10535:95f3daa991a2
2992 if(val) 2992 if(val)
2993 return -1; 2993 return -1;
2994 2994
2995 /* We have a GBSC probably with GSTUFF */ 2995 /* We have a GBSC probably with GSTUFF */
2996 skip_bits(&s->gb, 16); /* Drop the zeros */ 2996 skip_bits(&s->gb, 16); /* Drop the zeros */
2997 left= s->gb.size_in_bits - get_bits_count(&s->gb); 2997 left= get_bits_left(&s->gb);
2998 //MN: we must check the bits left or we might end in a infinite loop (or segfault) 2998 //MN: we must check the bits left or we might end in a infinite loop (or segfault)
2999 for(;left>13; left--){ 2999 for(;left>13; left--){
3000 if(get_bits1(&s->gb)) break; /* Seek the '1' bit */ 3000 if(get_bits1(&s->gb)) break; /* Seek the '1' bit */
3001 } 3001 }
3002 if(left<=13) 3002 if(left<=13)
3327 return pos; 3327 return pos;
3328 } 3328 }
3329 //OK, it's not where it is supposed to be ... 3329 //OK, it's not where it is supposed to be ...
3330 s->gb= s->last_resync_gb; 3330 s->gb= s->last_resync_gb;
3331 align_get_bits(&s->gb); 3331 align_get_bits(&s->gb);
3332 left= s->gb.size_in_bits - get_bits_count(&s->gb); 3332 left= get_bits_left(&s->gb);
3333 3333
3334 for(;left>16+1+5+5; left-=8){ 3334 for(;left>16+1+5+5; left-=8){
3335 if(show_bits(&s->gb, 16)==0){ 3335 if(show_bits(&s->gb, 16)==0){
3336 GetBitContext bak= s->gb; 3336 GetBitContext bak= s->gb;
3337 3337
3772 } 3772 }
3773 3773
3774 /* per-MB end of slice check */ 3774 /* per-MB end of slice check */
3775 3775
3776 if(--s->mb_num_left <= 0){ 3776 if(--s->mb_num_left <= 0){
3777 //printf("%06X %d\n", show_bits(&s->gb, 24), s->gb.size_in_bits - get_bits_count(&s->gb)); 3777 //printf("%06X %d\n", show_bits(&s->gb, 24), get_bits_left(&s->gb));
3778 if(mpeg4_is_resync(s)) 3778 if(mpeg4_is_resync(s))
3779 return SLICE_END; 3779 return SLICE_END;
3780 else 3780 else
3781 return SLICE_NOEND; 3781 return SLICE_NOEND;
3782 }else{ 3782 }else{
5032 5032
5033 align_get_bits(&s->gb); 5033 align_get_bits(&s->gb);
5034 5034
5035 startcode= get_bits(&s->gb, 22-8); 5035 startcode= get_bits(&s->gb, 22-8);
5036 5036
5037 for(i= s->gb.size_in_bits - get_bits_count(&s->gb); i>24; i-=8) { 5037 for(i= get_bits_left(&s->gb); i>24; i-=8) {
5038 startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF; 5038 startcode = ((startcode << 8) | get_bits(&s->gb, 8)) & 0x003FFFFF;
5039 5039
5040 if(startcode == 0x20) 5040 if(startcode == 0x20)
5041 break; 5041 break;
5042 } 5042 }