]> git.sesse.net Git - x264/commitdiff
Simplify addressing logic for interlaced-related arrays
authorFiona Glaser <fiona@x264.com>
Tue, 17 Aug 2010 00:47:11 +0000 (17:47 -0700)
committerFiona Glaser <fiona@x264.com>
Tue, 24 Aug 2010 15:28:45 +0000 (11:28 -0400)
In progressive mode, just make [0] and [1] point to the same place.

common/deblock.c
common/macroblock.c
encoder/encoder.c

index 7b00903b74e4e67ddb90a5df140901f408bcc338..cb9f0b4c4546f20ed2addf8fcf7f2de67ec19e41 100644 (file)
@@ -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
index 92b13aaa06bc0f90cc41193af32c4e6ef2a72c63..f8a689e871691fdc9fb533e80448c30973e964d8 100644 (file)
@@ -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] );
index 58d369e902a673ad49d218406f23bb639ba61a8a..6f98b676a6cddc8970ac7e9fd6506c52438b53c0 100644 (file)
@@ -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) );