# HG changeset patch # User michael # Date 1263642935 0 # Node ID f112b4d030fa0cfa728968fd1d7b6efbd8d007e7 # Parent 1cebb3ea364b49a705dc4d71af2d647538a35407 Avoid wasting 4 cpu cycles per MB in redundantly calculating qp_thresh. diff -r 1cebb3ea364b -r f112b4d030fa h264.c --- a/h264.c Sat Jan 16 10:46:45 2010 +0000 +++ b/h264.c Sat Jan 16 11:55:35 2010 +0000 @@ -2110,6 +2110,7 @@ return 1; // deblocking switched inside frame } } + h->qp_thresh= 15 - h->slice_alpha_c0_offset - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]); #if 0 //FMO if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5) diff -r 1cebb3ea364b -r f112b4d030fa h264.h --- a/h264.h Sat Jan 16 10:46:45 2010 +0000 +++ b/h264.h Sat Jan 16 11:55:35 2010 +0000 @@ -273,6 +273,8 @@ int chroma_qp[2]; //QPc + int qp_thresh; ///< QP threshold to skip loopfilter + int prev_mb_skipped; int next_mb_skipped; diff -r 1cebb3ea364b -r f112b4d030fa h264_loopfilter.c --- a/h264_loopfilter.c Sat Jan 16 10:46:45 2010 +0000 +++ b/h264_loopfilter.c Sat Jan 16 11:55:35 2010 +0000 @@ -654,7 +654,7 @@ //for sufficiently low qp, filtering wouldn't do anything //this is a conservative estimate: could also check beta_offset and more accurate chroma_qp if(!FRAME_MBAFF){ - int qp_thresh = 15 - h->slice_alpha_c0_offset - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]); + int qp_thresh = h->qp_thresh; int qp = s->current_picture.qscale_table[mb_xy]; if(qp <= qp_thresh && (mb_x == 0 || ((qp + s->current_picture.qscale_table[mb_xy-1] + 1)>>1) <= qp_thresh)