Mercurial > libavcodec.hg
comparison h264.c @ 3482:c08b46172204 libavcodec
slightly faster h264 fill_caches()
author | lorenm |
---|---|
date | Sun, 16 Jul 2006 18:55:18 +0000 |
parents | cc4b4ea83e29 |
children | 5ef29058581e |
comparison
equal
deleted
inserted
replaced
3481:f51065637305 | 3482:c08b46172204 |
---|---|
512 int topleft_xy, top_xy, topright_xy, left_xy[2]; | 512 int topleft_xy, top_xy, topright_xy, left_xy[2]; |
513 int topleft_type, top_type, topright_type, left_type[2]; | 513 int topleft_type, top_type, topright_type, left_type[2]; |
514 int left_block[8]; | 514 int left_block[8]; |
515 int i; | 515 int i; |
516 | 516 |
517 //FIXME deblocking can skip fill_caches much of the time with multiple slices too. | 517 //FIXME deblocking could skip the intra and nnz parts. |
518 // the actual condition is whether we're on the edge of a slice, | 518 if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[mb_xy-s->mb_stride]) && !FRAME_MBAFF) |
519 // and even then the intra and nnz parts are unnecessary. | |
520 if(for_deblock && h->slice_num == 1 && !FRAME_MBAFF) | |
521 return; | 519 return; |
522 | 520 |
523 //wow what a mess, why didn't they simplify the interlacing&intra stuff, i can't imagine that these complex rules are worth it | 521 //wow what a mess, why didn't they simplify the interlacing&intra stuff, i can't imagine that these complex rules are worth it |
524 | 522 |
525 top_xy = mb_xy - s->mb_stride; | 523 top_xy = mb_xy - s->mb_stride; |
602 | 600 |
603 h->top_mb_xy = top_xy; | 601 h->top_mb_xy = top_xy; |
604 h->left_mb_xy[0] = left_xy[0]; | 602 h->left_mb_xy[0] = left_xy[0]; |
605 h->left_mb_xy[1] = left_xy[1]; | 603 h->left_mb_xy[1] = left_xy[1]; |
606 if(for_deblock){ | 604 if(for_deblock){ |
607 topleft_type = h->slice_table[topleft_xy ] < 255 ? s->current_picture.mb_type[topleft_xy] : 0; | 605 topleft_type = 0; |
606 topright_type = 0; | |
608 top_type = h->slice_table[top_xy ] < 255 ? s->current_picture.mb_type[top_xy] : 0; | 607 top_type = h->slice_table[top_xy ] < 255 ? s->current_picture.mb_type[top_xy] : 0; |
609 topright_type= h->slice_table[topright_xy] < 255 ? s->current_picture.mb_type[topright_xy]: 0; | |
610 left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; | 608 left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; |
611 left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; | 609 left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; |
612 | 610 |
613 if(FRAME_MBAFF && !IS_INTRA(mb_type)){ | 611 if(FRAME_MBAFF && !IS_INTRA(mb_type)){ |
614 int list; | 612 int list; |
779 h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; | 777 h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; |
780 } | 778 } |
781 } | 779 } |
782 | 780 |
783 #if 1 | 781 #if 1 |
784 //FIXME direct mb can skip much of this | |
785 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ | 782 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ |
786 int list; | 783 int list; |
787 for(list=0; list<1+(h->slice_type==B_TYPE); list++){ | 784 for(list=0; list<1+(h->slice_type==B_TYPE); list++){ |
788 if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ | 785 if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ |
789 /*if(!h->mv_cache_clean[list]){ | 786 /*if(!h->mv_cache_clean[list]){ |
865 }else{ | 862 }else{ |
866 *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0; | 863 *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0; |
867 h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; | 864 h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; |
868 } | 865 } |
869 | 866 |
867 if(IS_SKIP(mb_type) || IS_DIRECT(mb_type)) | |
868 continue; | |
870 | 869 |
871 h->ref_cache[list][scan8[5 ]+1] = | 870 h->ref_cache[list][scan8[5 ]+1] = |
872 h->ref_cache[list][scan8[7 ]+1] = | 871 h->ref_cache[list][scan8[7 ]+1] = |
873 h->ref_cache[list][scan8[13]+1] = //FIXME remove past 3 (init somewhere else) | 872 h->ref_cache[list][scan8[13]+1] = //FIXME remove past 3 (init somewhere else) |
874 h->ref_cache[list][scan8[4 ]] = | 873 h->ref_cache[list][scan8[4 ]] = |
6378 for( i = 0; i < 4; i++ ) { | 6377 for( i = 0; i < 4; i++ ) { |
6379 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); | 6378 h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); |
6380 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; | 6379 sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; |
6381 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; | 6380 h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; |
6382 } | 6381 } |
6383 if( IS_DIRECT(h->sub_mb_type[0]) || IS_DIRECT(h->sub_mb_type[1]) | 6382 if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | |
6384 || IS_DIRECT(h->sub_mb_type[2]) || IS_DIRECT(h->sub_mb_type[3])) { | 6383 h->sub_mb_type[2] | h->sub_mb_type[3]) ) { |
6385 pred_direct_motion(h, &mb_type); | 6384 pred_direct_motion(h, &mb_type); |
6386 if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { | 6385 if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { |
6387 for( i = 0; i < 4; i++ ) | 6386 for( i = 0; i < 4; i++ ) |
6388 if( IS_DIRECT(h->sub_mb_type[i]) ) | 6387 if( IS_DIRECT(h->sub_mb_type[i]) ) |
6389 fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); | 6388 fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); |