]> git.sesse.net Git - x264/commitdiff
Deblock B-frames. (Not yet used, since B-frames aren't kept as references.)
authorLoren Merritt <pengvado@videolan.org>
Mon, 14 Feb 2005 11:08:00 +0000 (11:08 +0000)
committerLoren Merritt <pengvado@videolan.org>
Mon, 14 Feb 2005 11:08:00 +0000 (11:08 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@126 df754926-b1dd-0310-bc7b-ec298dee348c

common/frame.c

index 4c67e481f98535ed889c096693ecd4f8c3e2697d..ca6aba9093b14197ce232dec300b97670bd63402 100644 (file)
@@ -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;
-                        }
                     }
                 }