]> git.sesse.net Git - x264/commitdiff
MBAFF: Store references to the two left macroblocks
authorSimon Horlick <simonhorlick@gmail.com>
Tue, 11 Jan 2011 20:21:26 +0000 (20:21 +0000)
committerFiona Glaser <fiona@x264.com>
Thu, 12 May 2011 06:06:03 +0000 (23:06 -0700)
common/common.h
common/deblock.c
common/macroblock.c
common/mvpred.c
encoder/analyse.c
encoder/cabac.c

index 07dfbcd1f20d9ef6b72ee371540048853b347ed3..2be19e0f596b16f4e4d38ef5c2ae3ff75e07d367 100644 (file)
@@ -603,11 +603,11 @@ struct x264_t
         unsigned int i_neighbour_intra;     /* for constrained intra pred */
         unsigned int i_neighbour_frame;     /* ignoring slice boundaries */
         int     i_mb_type_top;
-        int     i_mb_type_left;
+        int     i_mb_type_left[2];
         int     i_mb_type_topleft;
         int     i_mb_type_topright;
         int     i_mb_prev_xy;
-        int     i_mb_left_xy;
+        int     i_mb_left_xy[2];
         int     i_mb_top_xy;
         int     i_mb_topleft_xy;
         int     i_mb_topright_xy;
index d7709b1ecd57a2a0d6f3c37950f0d9522566b2e5..78d84e2756f846e94a16b283b56a7cfd5deeaefc 100644 (file)
@@ -347,10 +347,10 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
 
         if( h->mb.i_neighbour & MB_LEFT )
         {
-            int qpl = h->mb.qp[h->mb.i_mb_left_xy];
+            int qpl = h->mb.qp[h->mb.i_mb_left_xy[0]];
             int qp_left = (qp + qpl + 1) >> 1;
             int qpc_left = (h->chroma_qp_table[qp] + h->chroma_qp_table[qpl] + 1) >> 1;
-            int intra_left = IS_INTRA( h->mb.type[h->mb.i_mb_left_xy] );
+            int intra_left = IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[0]] );
             if( intra_cur || intra_left )
                 FILTER( _intra, 0, 0, qp_left, qpc_left );
             else
index be31266e92305fd0234e961486462cfd42a09d8a..70863ecb438211f3014a5a0503f5ab2560d72e0e 100644 (file)
@@ -574,11 +574,11 @@ static void inline x264_macroblock_cache_load_neighbours( x264_t *h, int mb_x, i
     h->mb.i_neighbour_intra = 0;
     h->mb.i_neighbour_frame = 0;
     h->mb.i_mb_top_xy = -1;
-    h->mb.i_mb_left_xy = -1;
+    h->mb.i_mb_left_xy[0] = h->mb.i_mb_left_xy[1] = -1;
     h->mb.i_mb_topleft_xy = -1;
     h->mb.i_mb_topright_xy = -1;
     h->mb.i_mb_type_top = -1;
-    h->mb.i_mb_type_left = -1;
+    h->mb.i_mb_type_left[0] = h->mb.i_mb_type_left[1] = -1;
     h->mb.i_mb_type_topleft = -1;
     h->mb.i_mb_type_topright = -1;
     h->mb.left_index_table = &left_indices[3];
@@ -586,13 +586,13 @@ static void inline x264_macroblock_cache_load_neighbours( x264_t *h, int mb_x, i
     if( mb_x > 0 )
     {
         h->mb.i_neighbour_frame |= MB_LEFT;
-        h->mb.i_mb_left_xy = h->mb.i_mb_xy - 1;
-        h->mb.i_mb_type_left = h->mb.type[h->mb.i_mb_left_xy];
+        h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1;
+        h->mb.i_mb_type_left[0] = h->mb.type[h->mb.i_mb_left_xy[0]];
         if( h->mb.i_mb_xy > h->sh.i_first_mb )
         {
             h->mb.i_neighbour |= MB_LEFT;
 
-            if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_left ) )
+            if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_left[0] ) )
                 h->mb.i_neighbour_intra |= MB_LEFT;
         }
     }
@@ -658,7 +658,7 @@ void x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y )
 {
     x264_macroblock_cache_load_neighbours( h, mb_x, mb_y );
 
-    int left = h->mb.i_mb_left_xy;
+    int left = h->mb.i_mb_left_xy[0];
     int top  = h->mb.i_mb_top_xy;
     int top_y = mb_y - (1 << h->mb.b_interlaced);
     int s8x8 = h->mb.i_b8_stride;
@@ -926,8 +926,8 @@ void x264_macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_
 
     if( mb_x > 0 )
     {
-        h->mb.i_mb_left_xy = h->mb.i_mb_xy - 1;
-        if( deblock_on_slice_edges || h->mb.slice_table[h->mb.i_mb_left_xy] == h->mb.slice_table[h->mb.i_mb_xy] )
+        h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1;
+        if( deblock_on_slice_edges || h->mb.slice_table[h->mb.i_mb_left_xy[0]] == h->mb.slice_table[h->mb.i_mb_xy] )
             h->mb.i_neighbour |= MB_LEFT;
     }
 
@@ -970,7 +970,7 @@ void x264_macroblock_cache_load_deblock( x264_t *h )
 
             if( h->mb.i_neighbour & MB_LEFT )
             {
-                int left = h->mb.i_mb_left_xy;
+                int left = h->mb.i_mb_left_xy[0];
                 h->mb.cache.non_zero_count[x264_scan8[0 ] - 1] = nnz[left][left_index_table->nnz[0]];
                 h->mb.cache.non_zero_count[x264_scan8[2 ] - 1] = nnz[left][left_index_table->nnz[1]];
                 h->mb.cache.non_zero_count[x264_scan8[8 ] - 1] = nnz[left][left_index_table->nnz[2]];
@@ -1045,7 +1045,7 @@ void x264_macroblock_cache_load_deblock( x264_t *h )
     {
         uint8_t (*nnz)[24] = h->mb.non_zero_count;
         int top = h->mb.i_mb_top_xy;
-        int left = h->mb.i_mb_left_xy;
+        int left = h->mb.i_mb_left_xy[0];
 
         if( (h->mb.i_neighbour & MB_TOP) && h->mb.mb_transform_size[top] )
         {
index ae78a04132943c1d9b9d82e6dc53084705bb05a8..304bfca5791b1b5e35ee1b54d5bec6ea2dd7fb1c 100644 (file)
@@ -426,7 +426,7 @@ void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[
     }
 
     /* spatial predictors */
-    SET_MVP( mvr[h->mb.i_mb_left_xy] );
+    SET_MVP( mvr[h->mb.i_mb_left_xy[0]] );
     SET_MVP( mvr[h->mb.i_mb_top_xy] );
     SET_MVP( mvr[h->mb.i_mb_topleft_xy] );
     SET_MVP( mvr[h->mb.i_mb_topright_xy] );
index 3d00c371d97377e3bba6f71d2115f7d210700db5..f511dc64e238eb1dfc708c1e6c9fdf9fafad2309 100644 (file)
@@ -536,7 +536,7 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp )
         {
             /* Always run in fast-intra mode for subme < 3 */
             if( h->mb.i_subpel_refine > 2 &&
-              ( IS_INTRA( h->mb.i_mb_type_left ) ||
+              ( IS_INTRA( h->mb.i_mb_type_left[0] ) ||
                 IS_INTRA( h->mb.i_mb_type_top ) ||
                 IS_INTRA( h->mb.i_mb_type_topleft ) ||
                 IS_INTRA( h->mb.i_mb_type_topright ) ||
@@ -1316,7 +1316,7 @@ static void x264_mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t
     /* early termination: if 16x16 chose ref 0, then evalute no refs older
      * than those used by the neighbors */
     if( i_maxref > 0 && (a->l0.me16x16.i_ref == 0 || a->l0.me16x16.i_ref == h->mb.ref_blind_dupe) &&
-        h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left > 0 )
+        h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left[0] > 0 )
     {
         i_maxref = 0;
         CHECK_NEIGHBOUR(  -8 - 1 );
@@ -2083,7 +2083,7 @@ static void x264_mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t
     {
         x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0;
         if( i_maxref[l] > 0 && lX->me16x16.i_ref == 0 &&
-            h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left > 0 )
+            h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left[0] > 0 )
         {
             i_maxref[l] = 0;
             CHECK_NEIGHBOUR(  -8 - 1 );
@@ -2837,7 +2837,7 @@ intra_analysis:
                     {}
                 else if( h->param.analyse.i_subpel_refine >= 3 )
                     analysis.b_try_skip = 1;
-                else if( h->mb.i_mb_type_left == P_SKIP ||
+                else if( h->mb.i_mb_type_left[0] == P_SKIP ||
                          h->mb.i_mb_type_top == P_SKIP ||
                          h->mb.i_mb_type_topleft == P_SKIP ||
                          h->mb.i_mb_type_topright == P_SKIP )
index b2c608c26c527b481e549999a242cf2519757920..b8fef80fe87c9f6f5b0a862f3d11d4433c4fb15d 100644 (file)
@@ -79,7 +79,7 @@ static void x264_cabac_mb_type( x264_t *h, x264_cabac_t *cb )
     if( h->sh.i_type == SLICE_TYPE_I )
     {
         int ctx = 0;
-        if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left != I_4x4 )
+        if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != I_4x4 )
             ctx++;
         if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != I_4x4 )
             ctx++;
@@ -113,7 +113,7 @@ static void x264_cabac_mb_type( x264_t *h, x264_cabac_t *cb )
     else //if( h->sh.i_type == SLICE_TYPE_B )
     {
         int ctx = 0;
-        if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left != B_SKIP && h->mb.i_mb_type_left != B_DIRECT )
+        if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != B_SKIP && h->mb.i_mb_type_left[0] != B_DIRECT )
             ctx++;
         if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != B_SKIP && h->mb.i_mb_type_top != B_DIRECT )
             ctx++;
@@ -198,7 +198,7 @@ static void x264_cabac_mb_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb )
     int       ctx = 0;
 
     /* No need to test for I4x4 or I_16x16 as cache_save handle that */
-    if( (h->mb.i_neighbour & MB_LEFT) && h->mb.chroma_pred_mode[h->mb.i_mb_left_xy] != 0 )
+    if( (h->mb.i_neighbour & MB_LEFT) && h->mb.chroma_pred_mode[h->mb.i_mb_left_xy[0]] != 0 )
         ctx++;
     if( (h->mb.i_neighbour & MB_TOP) && h->mb.chroma_pred_mode[h->mb.i_mb_top_xy] != 0 )
         ctx++;
@@ -280,7 +280,7 @@ static void x264_cabac_mb_qp_delta( x264_t *h, x264_cabac_t *cb )
 #if !RDO_SKIP_BS
 void x264_cabac_mb_skip( x264_t *h, int b_skip )
 {
-    int ctx = ((h->mb.i_neighbour & MB_LEFT) && !IS_SKIP( h->mb.i_mb_type_left ))
+    int ctx = ((h->mb.i_neighbour & MB_LEFT) && !IS_SKIP( h->mb.i_mb_type_left[0] ))
             + ((h->mb.i_neighbour & MB_TOP) && !IS_SKIP( h->mb.i_mb_type_top ))
             + (h->sh.i_type == SLICE_TYPE_P ? 11 : 24);
     x264_cabac_encode_decision( &h->cabac, ctx, b_skip );