comparison h264_loopfilter.c @ 11015:d844c58b985a libavcodec

Use left_mb_xy from fill_caches instead of recalculating it.
author michael
date Tue, 26 Jan 2010 14:57:53 +0000
parents 5e5d44c920b6
children 4aee091df934
comparison
equal deleted inserted replaced
11014:51d8befcc773 11015:d844c58b985a
620 // and left mb is in the same slice if deblocking_filter == 2 620 // and left mb is in the same slice if deblocking_filter == 2
621 && h->left_type[0]) { 621 && h->left_type[0]) {
622 /* First vertical edge is different in MBAFF frames 622 /* First vertical edge is different in MBAFF frames
623 * There are 8 different bS to compute and 2 different Qp 623 * There are 8 different bS to compute and 2 different Qp
624 */ 624 */
625 const int pair_xy = mb_x + (mb_y&~1)*s->mb_stride;
626 const int left_mb_xy[2] = { pair_xy-1, pair_xy-1+s->mb_stride };
627 DECLARE_ALIGNED_8(int16_t, bS)[8]; 625 DECLARE_ALIGNED_8(int16_t, bS)[8];
628 int qp[2]; 626 int qp[2];
629 int bqp[2]; 627 int bqp[2];
630 int rqp[2]; 628 int rqp[2];
631 int mb_qp, mbn0_qp, mbn1_qp; 629 int mb_qp, mbn0_qp, mbn1_qp;
635 if( IS_INTRA(mb_type) ) 633 if( IS_INTRA(mb_type) )
636 *(uint64_t*)&bS[0]= 634 *(uint64_t*)&bS[0]=
637 *(uint64_t*)&bS[4]= 0x0004000400040004ULL; 635 *(uint64_t*)&bS[4]= 0x0004000400040004ULL;
638 else { 636 else {
639 for( i = 0; i < 8; i++ ) { 637 for( i = 0; i < 8; i++ ) {
640 int mbn_xy = MB_FIELD ? left_mb_xy[i>>2] : left_mb_xy[i&1]; 638 int mbn_xy = MB_FIELD ? h->left_mb_xy[i>>2] : h->left_mb_xy[i&1];
641 639
642 if( IS_INTRA( s->current_picture.mb_type[mbn_xy] ) ) 640 if( IS_INTRA( s->current_picture.mb_type[mbn_xy] ) )
643 bS[i] = 4; 641 bS[i] = 4;
644 else if( h->non_zero_count_cache[12+8*(i>>1)] != 0 || 642 else if( h->non_zero_count_cache[12+8*(i>>1)] != 0 ||
645 ((!h->pps.cabac && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])) ? 643 ((!h->pps.cabac && IS_8x8DCT(s->current_picture.mb_type[mbn_xy])) ?
651 bS[i] = 1; 649 bS[i] = 1;
652 } 650 }
653 } 651 }
654 652
655 mb_qp = s->current_picture.qscale_table[mb_xy]; 653 mb_qp = s->current_picture.qscale_table[mb_xy];
656 mbn0_qp = s->current_picture.qscale_table[left_mb_xy[0]]; 654 mbn0_qp = s->current_picture.qscale_table[h->left_mb_xy[0]];
657 mbn1_qp = s->current_picture.qscale_table[left_mb_xy[1]]; 655 mbn1_qp = s->current_picture.qscale_table[h->left_mb_xy[1]];
658 qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1; 656 qp[0] = ( mb_qp + mbn0_qp + 1 ) >> 1;
659 bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) + 657 bqp[0] = ( get_chroma_qp( h, 0, mb_qp ) +
660 get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1; 658 get_chroma_qp( h, 0, mbn0_qp ) + 1 ) >> 1;
661 rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) + 659 rqp[0] = ( get_chroma_qp( h, 1, mb_qp ) +
662 get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1; 660 get_chroma_qp( h, 1, mbn0_qp ) + 1 ) >> 1;