Unroll loops in check_mv()

~6% faster (slow path) loopfilter (should be ~2% overall)

Originally committed as revision 21503 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2010-01-28 10:34:06 +00:00
parent e814817b74
commit ca7c784fdf
1 changed files with 17 additions and 14 deletions

View File

@ -425,23 +425,26 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
} }
static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){
int l; int v;
int v = 0;
for( l = 0; !v && l < h->list_count; l++ ) { v = h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] |
v |= h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] | h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U | FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit;
FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; if(h->list_count==2 && !v)
} v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] |
h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit;
if(h->list_count==2 && v){ if(h->list_count==2 && v){
v=0; if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] |
for( l = 0; !v && l < 2; l++ ) { h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U |
int ln= 1-l; FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit)
v |= h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] | return 1;
h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U | if(h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx] |
FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit; h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U |
} FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit)
return 1;
return 0;
} }
return v; return v;