From ac411e297aaaec200b33b6dab082e12c55c3b7ef Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Mon, 14 Feb 2005 11:08:00 +0000 Subject: [PATCH] Deblock B-frames. (Not yet used, since B-frames aren't kept as references.) git-svn-id: svn://svn.videolan.org/x264/trunk@126 df754926-b1dd-0310-bc7b-ec298dee348c --- common/frame.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/common/frame.c b/common/frame.c index 4c67e481..ca6aba90 100644 --- a/common/frame.c +++ b/common/frame.c @@ -699,25 +699,32 @@ void x264_frame_deblocking_filter( x264_t *h, int i_slice_type ) { bS[i] = 2; } - else if( i_slice_type == SLICE_TYPE_P ) + else { - if( h->mb.ref[0][mb_8x8+(x/2)+(y/2)*s8x8] != h->mb.ref[0][mbn_8x8+(xn/2)+(yn/2)*s8x8] || - abs( h->mb.mv[0][mb_4x4+x+y*s4x4][0] - h->mb.mv[0][mbn_4x4+xn+yn*s4x4][0] ) >= 4 || - abs( h->mb.mv[0][mb_4x4+x+y*s4x4][1] - h->mb.mv[0][mbn_4x4+xn+yn*s4x4][1] ) >= 4 ) - { - bS[i] = 1; - } - else + /* FIXME: A given frame may occupy more than one position in + * the reference list. So we should compare the frame numbers, + * not the indices in the ref list. + * No harm yet, as we don't generate that case.*/ + + int i8p= mb_8x8+(x/2)+(y/2)*s8x8; + int i8q= mbn_8x8+(xn/2)+(yn/2)*s8x8; + int i4p= mb_4x4+x+y*s4x4; + int i4q= mbn_4x4+xn+yn*s4x4; + int l; + + bS[i] = 0; + + for( l = 0; l < 1 + (i_slice_type == SLICE_TYPE_B); l++ ) { - bS[i] = 0; + if( h->mb.ref[l][i8p] != h->mb.ref[l][i8q] || + abs( h->mb.mv[l][i4p][0] - h->mb.mv[l][i4q][0] ) >= 4 || + abs( h->mb.mv[l][i4p][1] - h->mb.mv[l][i4q][1] ) >= 4 ) + { + bS[i] = 1; + break; + } } } - else - { - /* FIXME */ - x264_log( h, X264_LOG_ERROR, "deblocking filter doesn't work yet with B slice\n" ); - return; - } } } -- 2.47.3