]> granicus.if.org Git - libx264/commitdiff
fix spatial direct mv prediction with B-pyramid. copied from libavcodec.
authorLoren Merritt <pengvado@videolan.org>
Tue, 9 Aug 2005 18:48:57 +0000 (18:48 +0000)
committerLoren Merritt <pengvado@videolan.org>
Tue, 9 Aug 2005 18:48:57 +0000 (18:48 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@285 df754926-b1dd-0310-bc7b-ec298dee348c

common/macroblock.c
x264.h

index f9fb030ce70c03bff1d66b2f619e36602bdf52d4..f0f81da111943a7dcb21b44045c9cf088d86d8c5 100644 (file)
@@ -499,6 +499,9 @@ static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
         {
             /* the colocated ref isn't in the current list0 */
             /* FIXME: we might still be able to use direct_8x8 on some partitions */
+            /* FIXME: with B-pyramid + extensive ref list reordering
+             *   (not currently used), we would also have to check
+             *   l1mv1 like in spatial mode */
             return 0;
         }
     }
@@ -512,8 +515,11 @@ static int x264_mb_predict_mv_direct16x16_spatial( x264_t *h )
     int mv[2][2];
     int i_list;
     int i8, i4;
-    const int8_t *l1ref = &h->fref1[0]->ref[0][ h->mb.i_b8_xy ];
-    const int16_t (*l1mv)[2] = (const int16_t (*)[2]) &h->fref1[0]->mv[0][ h->mb.i_b4_xy ];
+    const int8_t *l1ref0 = &h->fref1[0]->ref[0][ h->mb.i_b8_xy ];
+    const int8_t *l1ref1 = &h->fref1[0]->ref[1][ h->mb.i_b8_xy ];
+    const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->fref1[0]->mv[0][ h->mb.i_b4_xy ];
+    const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->fref1[0]->mv[1][ h->mb.i_b4_xy ];
+    const int intra_col = IS_INTRA( h->fref1[0]->mb_type[ h->mb.i_mb_xy ] );
 
     for( i_list=0; i_list<2; i_list++ )
     {
@@ -562,8 +568,10 @@ static int x264_mb_predict_mv_direct16x16_spatial( x264_t *h )
     {
         const int x8 = i8%2;
         const int y8 = i8/2;
-        if( l1ref[ x8 + y8 * h->mb.i_b8_stride ] == 0 )
+        const int o8 = x8 + y8 * h->mb.i_b8_stride;
+        if( !intra_col && ( l1ref0[o8] == 0 || ( l1ref0[o8] < 0 && l1ref1[o8] == 0 ) ) )
         {
+            const int16_t (*l1mv)[2] = (l1ref0[o8] == 0) ? l1mv0 : l1mv1;
             for( i4=0; i4<4; i4++ )
             {
                 const int x4 = i4%2 + 2*x8;
diff --git a/x264.h b/x264.h
index 381c78d5812884c93eff0d07824211b3ecff1140..d695ef796edee44ebec1ae4579aaf86f089e4939 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -26,7 +26,7 @@
 
 #include <stdarg.h>
 
-#define X264_BUILD 33
+#define X264_BUILD 34
 
 /* x264_t:
  *      opaque handler for decoder and encoder */