Mercurial > libavcodec.hg
comparison h264_loopfilter.c @ 11038:ee6d89b26e7f libavcodec
Unroll loops in check_mv()
~6% faster (slow path) loopfilter (should be ~2% overall)
author | michael |
---|---|
date | Thu, 28 Jan 2010 10:34:06 +0000 |
parents | dfc8f928cc8a |
children | b9a6d26f48eb |
comparison
equal
deleted
inserted
replaced
11037:dfc8f928cc8a | 11038:ee6d89b26e7f |
---|---|
423 #undef FILTER | 423 #undef FILTER |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ | 427 static int check_mv(H264Context *h, long b_idx, long bn_idx, int mvy_limit){ |
428 int l; | 428 int v; |
429 int v = 0; | 429 |
430 | 430 v = h->ref_cache[0][b_idx] != h->ref_cache[0][bn_idx] | |
431 for( l = 0; !v && l < h->list_count; l++ ) { | 431 h->mv_cache[0][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | |
432 v |= h->ref_cache[l][b_idx] != h->ref_cache[l][bn_idx] | | 432 FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit; |
433 h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] + 3 >= 7U | | 433 if(h->list_count==2 && !v) |
434 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; | 434 v = h->ref_cache[1][b_idx] != h->ref_cache[1][bn_idx] | |
435 } | 435 h->mv_cache[1][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | |
436 FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit; | |
436 | 437 |
437 if(h->list_count==2 && v){ | 438 if(h->list_count==2 && v){ |
438 v=0; | 439 if(h->ref_cache[0][b_idx] != h->ref_cache[1][bn_idx] | |
439 for( l = 0; !v && l < 2; l++ ) { | 440 h->mv_cache[0][b_idx][0] - h->mv_cache[1][bn_idx][0] + 3 >= 7U | |
440 int ln= 1-l; | 441 FFABS( h->mv_cache[0][b_idx][1] - h->mv_cache[1][bn_idx][1] ) >= mvy_limit) |
441 v |= h->ref_cache[l][b_idx] != h->ref_cache[ln][bn_idx] | | 442 return 1; |
442 h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] + 3 >= 7U | | 443 if(h->ref_cache[1][b_idx] != h->ref_cache[0][bn_idx] | |
443 FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit; | 444 h->mv_cache[1][b_idx][0] - h->mv_cache[0][bn_idx][0] + 3 >= 7U | |
444 } | 445 FFABS( h->mv_cache[1][b_idx][1] - h->mv_cache[0][bn_idx][1] ) >= mvy_limit) |
446 return 1; | |
447 return 0; | |
445 } | 448 } |
446 | 449 |
447 return v; | 450 return v; |
448 } | 451 } |
449 | 452 |