[x264-devel] MBAFF: Store references to the two left macroblocks

Simon Horlick git at videolan.org
Thu May 12 08:38:58 CEST 2011


x264 | branch: master | Simon Horlick <simonhorlick at gmail.com> | Tue Jan 11 20:21:26 2011 +0000| [353802b3bed24be9f0a00a46f8a4c857be783ca2] | committer: Jason Garrett-Glaser

MBAFF: Store references to the two left macroblocks

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=353802b3bed24be9f0a00a46f8a4c857be783ca2
---

 common/common.h     |    4 ++--
 common/deblock.c    |    4 ++--
 common/macroblock.c |   20 ++++++++++----------
 common/mvpred.c     |    2 +-
 encoder/analyse.c   |    8 ++++----
 encoder/cabac.c     |    8 ++++----
 6 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/common/common.h b/common/common.h
index 07dfbcd..2be19e0 100644
--- a/common/common.h
+++ b/common/common.h
@@ -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;
diff --git a/common/deblock.c b/common/deblock.c
index b33e3e7..ed121bc 100644
--- a/common/deblock.c
+++ b/common/deblock.c
@@ -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
diff --git a/common/macroblock.c b/common/macroblock.c
index 867ea4d..6660bd6 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -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] )
         {
diff --git a/common/mvpred.c b/common/mvpred.c
index a24dde8..c8efe1f 100644
--- a/common/mvpred.c
+++ b/common/mvpred.c
@@ -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] );
diff --git a/encoder/analyse.c b/encoder/analyse.c
index b224d9e..33b94d4 100644
--- a/encoder/analyse.c
+++ b/encoder/analyse.c
@@ -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 )
diff --git a/encoder/cabac.c b/encoder/cabac.c
index 4859fe3..8c9f060 100644
--- a/encoder/cabac.c
+++ b/encoder/cabac.c
@@ -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 );



More information about the x264-devel mailing list