Mercurial > libavcodec.hg
comparison h263dec.c @ 1177:fea03d2c4946 libavcodec
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
more direct use of the new mb_type stuff instead of codec specific stuff
runtime mb_type debug output h264/h263 variants/mpeg1/2/4
error concealment /resilience for mpeg1/2
various minor optimizations
author | michaelni |
---|---|
date | Thu, 10 Apr 2003 13:18:38 +0000 |
parents | d2fd27d01df8 |
children | 03b97d87dcdd |
comparison
equal
deleted
inserted
replaced
1176:a39d55237445 | 1177:fea03d2c4946 |
---|---|
207 ret= s->decode_mb(s, s->block); | 207 ret= s->decode_mb(s, s->block); |
208 | 208 |
209 MPV_decode_mb(s, s->block); | 209 MPV_decode_mb(s, s->block); |
210 | 210 |
211 if(ret<0){ | 211 if(ret<0){ |
212 const int xy= s->mb_x + s->mb_y*s->mb_width; | 212 const int xy= s->mb_x + s->mb_y*s->mb_stride; |
213 if(ret==SLICE_END){ | 213 if(ret==SLICE_END){ |
214 //printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24)); | 214 //printf("%d %d %d %06X\n", s->mb_x, s->mb_y, s->gb.size*8 - get_bits_count(&s->gb), show_bits(&s->gb, 24)); |
215 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); | 215 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, (AC_END|DC_END|MV_END)&part_mask); |
216 | 216 |
217 s->padding_bug_score--; | 217 s->padding_bug_score--; |
642 #endif | 642 #endif |
643 | 643 |
644 ff_er_frame_start(s); | 644 ff_er_frame_start(s); |
645 | 645 |
646 /* decode each macroblock */ | 646 /* decode each macroblock */ |
647 s->block_wrap[0]= | |
648 s->block_wrap[1]= | |
649 s->block_wrap[2]= | |
650 s->block_wrap[3]= s->mb_width*2 + 2; | |
651 s->block_wrap[4]= | |
652 s->block_wrap[5]= s->mb_width + 2; | |
653 s->mb_x=0; | 647 s->mb_x=0; |
654 s->mb_y=0; | 648 s->mb_y=0; |
655 | 649 |
656 decode_slice(s); | 650 decode_slice(s); |
657 while(s->mb_y<s->mb_height && s->gb.size_in_bits - get_bits_count(&s->gb)>16){ | 651 while(s->mb_y<s->mb_height && s->gb.size_in_bits - get_bits_count(&s->gb)>16){ |
706 s->low_delay=0; //needed to see the vectors without trashing the buffers | 700 s->low_delay=0; //needed to see the vectors without trashing the buffers |
707 | 701 |
708 for(mb_y=0; mb_y<s->mb_height; mb_y++){ | 702 for(mb_y=0; mb_y<s->mb_height; mb_y++){ |
709 int mb_x; | 703 int mb_x; |
710 for(mb_x=0; mb_x<s->mb_width; mb_x++){ | 704 for(mb_x=0; mb_x<s->mb_width; mb_x++){ |
711 const int mb_index= mb_x + mb_y*s->mb_width; | 705 const int mb_index= mb_x + mb_y*s->mb_stride; |
712 if(s->co_located_type_table[mb_index] == MV_TYPE_8X8){ | 706 if(IS_8X8(s->current_picture.mb_type[mb_index])){ |
713 int i; | 707 int i; |
714 for(i=0; i<4; i++){ | 708 for(i=0; i<4; i++){ |
715 int sx= mb_x*16 + 4 + 8*(i&1); | 709 int sx= mb_x*16 + 4 + 8*(i&1); |
716 int sy= mb_y*16 + 4 + 8*(i>>1); | 710 int sy= mb_y*16 + 4 + 8*(i>>1); |
717 int xy= 1 + mb_x*2 + (i&1) + (mb_y*2 + 1 + (i>>1))*(s->mb_width*2 + 2); | 711 int xy= 1 + mb_x*2 + (i&1) + (mb_y*2 + 1 + (i>>1))*(s->mb_width*2 + 2); |
730 s->mbskip_table[mb_index]=0; | 724 s->mbskip_table[mb_index]=0; |
731 } | 725 } |
732 } | 726 } |
733 } | 727 } |
734 | 728 |
735 | |
736 if(s->pict_type==B_TYPE || s->low_delay){ | 729 if(s->pict_type==B_TYPE || s->low_delay){ |
737 *pict= *(AVFrame*)&s->current_picture; | 730 *pict= *(AVFrame*)&s->current_picture; |
731 ff_print_debug_info(s, s->current_picture_ptr); | |
738 } else { | 732 } else { |
739 *pict= *(AVFrame*)&s->last_picture; | 733 *pict= *(AVFrame*)&s->last_picture; |
740 } | 734 ff_print_debug_info(s, s->last_picture_ptr); |
741 | 735 } |
742 if(avctx->debug&FF_DEBUG_QP){ | 736 |
743 int8_t *qtab= pict->qscale_table; | |
744 int x,y; | |
745 | |
746 for(y=0; y<s->mb_height; y++){ | |
747 for(x=0; x<s->mb_width; x++){ | |
748 printf("%2d ", qtab[x + y*s->mb_width]); | |
749 } | |
750 printf("\n"); | |
751 } | |
752 printf("\n"); | |
753 } | |
754 | 737 |
755 /* Return the Picture timestamp as the frame number */ | 738 /* Return the Picture timestamp as the frame number */ |
756 /* we substract 1 because it is added on utils.c */ | 739 /* we substract 1 because it is added on utils.c */ |
757 avctx->frame_number = s->picture_number - 1; | 740 avctx->frame_number = s->picture_number - 1; |
758 | 741 |