diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-07-22 17:44:36 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-07-22 17:44:36 +0000 |
commit | 2e916cb392d6f8cebf7d733976369c3f5828b4f1 (patch) | |
tree | f25098d2851dc1a55fe98b4d959bebe5fd9501c1 | |
parent | 5a78bfbde74620137ccbd8c223300ac639107f60 (diff) | |
download | ffmpeg-2e916cb392d6f8cebf7d733976369c3f5828b4f1.tar.gz |
3rd try to get the loop filter ref/mv check working correctly.
Fixes at least:
src19td.IBP.264
CVWP3_TOSHIBA_E.264
cvmp_mot_picaff0_full_B.26l
CVMP_MOT_FRM_L31_B.26l
cvmp_mot_frm0_full_B.26l
CVMP_MOT_FLD_L30_B.26l
cvmp_mot_fld0_full_B.26l
Originally committed as revision 14337 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 213e03b087..a2e161d12e 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -6731,14 +6731,23 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 int b_idx= 8 + 4 + edge * (dir ? 8:1); int bn_idx= b_idx - (dir ? 8:1); int v = 0; - int xn= h->slice_type_nos == FF_B_TYPE && ref2frm[0][h->ref_cache[0][b_idx]+2] != ref2frmn[0][h->ref_cache[0][bn_idx]+2]; for( l = 0; !v && l < 1 + (h->slice_type_nos == FF_B_TYPE); l++ ) { - int ln= l^xn; - v |= ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[ln][h->ref_cache[ln][bn_idx]+2] || - FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || - FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit; + v |= ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[l][h->ref_cache[l][bn_idx]+2] || + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit; } + + if(h->slice_type_nos == FF_B_TYPE && v){ + v=0; + for( l = 0; !v && l < 2; l++ ) { + int ln= 1-l; + v |= ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[ln][h->ref_cache[ln][bn_idx]+2] || + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit; + } + } + bS[0] = bS[1] = bS[2] = bS[3] = v; mv_done = 1; } @@ -6757,17 +6766,28 @@ static void filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8 } else if(!mv_done) { - int xn= h->slice_type_nos == FF_B_TYPE && ref2frm[0][h->ref_cache[0][b_idx]+2] != ref2frmn[0][h->ref_cache[0][bn_idx]+2]; bS[i] = 0; for( l = 0; l < 1 + (h->slice_type_nos == FF_B_TYPE); l++ ) { - int ln= l^xn; - if( ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[ln][h->ref_cache[ln][bn_idx]+2] || - FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || - FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) { + if( ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[l][h->ref_cache[l][bn_idx]+2] || + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[l][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[l][bn_idx][1] ) >= mvy_limit ) { bS[i] = 1; break; } } + + if(h->slice_type_nos == FF_B_TYPE && bS[i]){ + bS[i] = 0; + for( l = 0; l < 2; l++ ) { + int ln= 1-l; + if( ref2frm[l][h->ref_cache[l][b_idx]+2] != ref2frmn[ln][h->ref_cache[ln][bn_idx]+2] || + FFABS( h->mv_cache[l][b_idx][0] - h->mv_cache[ln][bn_idx][0] ) >= 4 || + FFABS( h->mv_cache[l][b_idx][1] - h->mv_cache[ln][bn_idx][1] ) >= mvy_limit ) { + bS[i] = 1; + break; + } + } + } } } |