[x264-devel] commit: Simplify addressing logic for interlaced-related arrays ( Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Tue Aug 24 20:03:44 CEST 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Mon Aug 16 17:47:11 2010 -0700| [c74f9c99a9af959c137f33a20d17bd55b3deb11d] | committer: Jason Garrett-Glaser 

Simplify addressing logic for interlaced-related arrays
In progressive mode, just make [0] and [1] point to the same place.

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

 common/deblock.c    |    4 ++--
 common/macroblock.c |    6 ++++--
 encoder/encoder.c   |    2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/common/deblock.c b/common/deblock.c
index 0b61248..2d4f230 100644
--- a/common/deblock.c
+++ b/common/deblock.c
@@ -316,7 +316,7 @@ void x264_frame_deblock_row( x264_t *h, int mb_y )
         int mb_xy = h->mb.i_mb_xy;
         int transform_8x8 = h->mb.mb_transform_size[h->mb.i_mb_xy];
         int intra_cur = IS_INTRA( h->mb.type[mb_xy] );
-        uint8_t (*bs)[4][4] = h->deblock_strength[mb_y&b_interlaced][mb_x];
+        uint8_t (*bs)[4][4] = h->deblock_strength[mb_y&1][mb_x];
 
         pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey  + 16*mb_x;
         pixel *pixuv = h->fdec->plane[1] + 8*mb_y*strideuv + 16*mb_x;
@@ -403,7 +403,7 @@ void x264_macroblock_deblock( x264_t *h )
     if( qp <= qp_thresh || h->mb.i_type == P_SKIP )
         return;
 
-    uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&h->sh.b_mbaff][h->mb.i_mb_x];
+    uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&1][h->mb.i_mb_x];
     if( IS_INTRA( h->mb.i_type ) )
         memset( bs, 3, 2*4*4*sizeof(uint8_t) );
     else
diff --git a/common/macroblock.c b/common/macroblock.c
index 5899b15..7347645 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -320,8 +320,10 @@ int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead )
                 /* shouldn't really be initialized, just silences a valgrind false-positive in predict_8x8_filter_mmx */
                 CHECKED_MALLOCZERO( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * sizeof(pixel) );
                 h->intra_border_backup[i][j] += 16;
+                h->intra_border_backup[1][j] = h->intra_border_backup[i][j];
             }
             CHECKED_MALLOC( h->deblock_strength[i], sizeof(**h->deblock_strength) * h->mb.i_mb_width );
+            h->deblock_strength[1] = h->deblock_strength[i];
         }
 
     /* Allocate scratch buffer */
@@ -493,7 +495,7 @@ static void ALWAYS_INLINE x264_macroblock_load_pic_pointers( x264_t *h, int mb_x
                      ? 16 * mb_x + w * (mb_y&~1) * i_stride + (mb_y&1) * i_stride
                      : 16 * mb_x + w * mb_y * i_stride;
     pixel *plane_fdec = &h->fdec->plane[i][i_pix_offset];
-    pixel *intra_fdec = &h->intra_border_backup[mb_y & h->sh.b_mbaff][i][mb_x*16];
+    pixel *intra_fdec = &h->intra_border_backup[mb_y&1][i][mb_x*16];
     int ref_pix_offset[2] = { i_pix_offset, i_pix_offset };
     x264_frame_t **fref[2] = { h->fref0, h->fref1 };
     if( b_interlaced )
@@ -1086,7 +1088,7 @@ static void ALWAYS_INLINE x264_macroblock_store_pic( x264_t *h, int mb_x, int mb
     int i_pix_offset = b_interlaced
                      ? 16 * mb_x + w * (mb_y&~1) * i_stride + (mb_y&1) * i_stride
                      : 16 * mb_x + w * mb_y * i_stride;
-    pixel *intra_fdec = &h->intra_border_backup[mb_y & h->sh.b_mbaff][i][mb_x*16];
+    pixel *intra_fdec = &h->intra_border_backup[mb_y&1][i][mb_x*16];
     if( i )
     {
         h->mc.store_interleave_8x8x2( &h->fdec->plane[1][i_pix_offset], i_stride2, h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[2] );
diff --git a/encoder/encoder.c b/encoder/encoder.c
index 52b6fb5..0b65d51 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -2038,7 +2038,7 @@ static int x264_slice_write( x264_t *h )
         if( b_deblock )
         {
             int mvy_limit = 4 >> h->sh.b_mbaff;
-            uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&h->sh.b_mbaff][h->mb.i_mb_x];
+            uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&1][h->mb.i_mb_x];
             x264_macroblock_cache_load_deblock( h );
             if( IS_INTRA( h->mb.type[h->mb.i_mb_xy] ) )
                 memset( bs, 3, 2*4*4*sizeof(uint8_t) );



More information about the x264-devel mailing list