Mercurial > libavcodec.hg
comparison h263.c @ 331:853e1eb30468 libavcodec
fix b-frame MB skip
author | michaelni |
---|---|
date | Sun, 21 Apr 2002 23:47:27 +0000 |
parents | d359db02fc90 |
children | 8aa87f1dfc52 |
comparison
equal
deleted
inserted
replaced
330:54d86f074a4b | 331:853e1eb30468 |
---|---|
349 bits= get_bit_count(&s->pb); | 349 bits= get_bit_count(&s->pb); |
350 s->p_tex_bits+= bits - s->last_bits; | 350 s->p_tex_bits+= bits - s->last_bits; |
351 s->last_bits=bits; | 351 s->last_bits=bits; |
352 }else{ /* s->pict_type==B_TYPE */ | 352 }else{ /* s->pict_type==B_TYPE */ |
353 if ((cbp | motion_x | motion_y) == 0 && s->mv_type==MV_TYPE_16X16) { | 353 if ((cbp | motion_x | motion_y) == 0 && s->mv_type==MV_TYPE_16X16) { |
354 /* skip macroblock */ | 354 /* check if the B frames can skip it too, as we must skip it if we skip here |
355 put_bits(&s->pb, 1, 1); | 355 why didnt they just compress the skip-mb bits instead of reusing them ?! */ |
356 s->misc_bits++; | 356 if(s->max_b_frames>0){ |
357 s->last_bits++; | 357 int i; |
358 s->skip_count++; | 358 const int offset= (s->mb_x + s->mb_y*s->linesize)*16; |
359 s->mb_skiped=1; // we need that for b-frames | 359 uint8_t *p_pic= s->new_picture[0] + offset; |
360 return; | 360 s->mb_skiped=1; |
361 for(i=0; i<s->max_b_frames; i++){ | |
362 uint8_t *b_pic= s->coded_order[i+1].picture[0] + offset; | |
363 int diff= pix_abs16x16(p_pic, b_pic, s->linesize); | |
364 if(diff>s->qscale*70){ | |
365 s->mb_skiped=0; | |
366 break; | |
367 } | |
368 } | |
369 }else | |
370 s->mb_skiped=1; | |
371 | |
372 if(s->mb_skiped==1){ | |
373 /* skip macroblock */ | |
374 put_bits(&s->pb, 1, 1); | |
375 s->misc_bits++; | |
376 s->last_bits++; | |
377 s->skip_count++; | |
378 return; | |
379 } | |
361 } | 380 } |
362 put_bits(&s->pb, 1, 0); /* mb coded */ | 381 put_bits(&s->pb, 1, 0); /* mb coded */ |
363 if(s->mv_type==MV_TYPE_16X16){ | 382 if(s->mv_type==MV_TYPE_16X16){ |
364 cbpc = cbp & 3; | 383 cbpc = cbp & 3; |
365 put_bits(&s->pb, | 384 put_bits(&s->pb, |
2600 height = get_bits(&s->gb, 13); | 2619 height = get_bits(&s->gb, 13); |
2601 skip_bits1(&s->gb); /* marker */ | 2620 skip_bits1(&s->gb); /* marker */ |
2602 if(width && height){ /* they should be non zero but who knows ... */ | 2621 if(width && height){ /* they should be non zero but who knows ... */ |
2603 s->width = width; | 2622 s->width = width; |
2604 s->height = height; | 2623 s->height = height; |
2605 // printf("%d %d\n", width, height); | 2624 // printf("width/height: %d %d\n", width, height); |
2606 } | 2625 } |
2607 } | 2626 } |
2608 | 2627 |
2609 if(get_bits1(&s->gb)) printf("interlaced not supported\n"); /* interlaced */ | 2628 if(get_bits1(&s->gb)) printf("interlaced not supported\n"); /* interlaced */ |
2610 if(!get_bits1(&s->gb)) printf("OBMC not supported\n"); /* OBMC Disable */ | 2629 if(!get_bits1(&s->gb)) printf("OBMC not supported\n"); /* OBMC Disable */ |
2858 } | 2877 } |
2859 if (s->pict_type == B_TYPE) { | 2878 if (s->pict_type == B_TYPE) { |
2860 s->b_code = get_bits(&s->gb, 3); | 2879 s->b_code = get_bits(&s->gb, 3); |
2861 //printf("b-code %d\n", s->b_code); | 2880 //printf("b-code %d\n", s->b_code); |
2862 } | 2881 } |
2863 //printf("quant:%d fcode:%d\n", s->qscale, s->f_code); | 2882 //printf("quant:%d fcode:%d bcode:%d type:%d\n", s->qscale, s->f_code, s->b_code, s->pict_type); |
2864 if(!s->scalability){ | 2883 if(!s->scalability){ |
2865 if (s->shape!=RECT_SHAPE && s->pict_type!=I_TYPE) { | 2884 if (s->shape!=RECT_SHAPE && s->pict_type!=I_TYPE) { |
2866 skip_bits1(&s->gb); // vop shape coding type | 2885 skip_bits1(&s->gb); // vop shape coding type |
2867 } | 2886 } |
2868 } | 2887 } |