]> git.videolan.org Git - x264.git/commitdiff
use array_non_zero() when we don't need a full array_non_zero_count()
authorLoren Merritt <pengvado@videolan.org>
Mon, 7 Nov 2005 07:53:42 +0000 (07:53 +0000)
committerLoren Merritt <pengvado@videolan.org>
Mon, 7 Nov 2005 07:53:42 +0000 (07:53 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@365 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/analyse.c
encoder/macroblock.c

index cdf785a46dd03c70bf1e6d777f3cc1a749d1b8cd..493228dc93714f9c7382e3c4a3a65d651ee36ca9 100644 (file)
@@ -608,7 +608,7 @@ static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_cost_
                 int i_mode;
 
                 i_mode = predict_mode[i];
-                h->predict_8x8[i_mode]( p_dst_by, i_stride, h->mb.i_neighbour );
+                h->predict_8x8[i_mode]( p_dst_by, i_stride, h->mb.i_neighbour8[idx] );
 
                 /* could use sa8d, but it doesn't seem worth the speed cost (without mmx at least) */
                 i_sad = h->pixf.mbcmp[PIXEL_8x8]( p_dst_by, i_stride,
index 50b9d778f24998d4cbff6d4e095b97bc062b85c2..551555e76407126cec9e38b0aa36d856dc039098 100644 (file)
@@ -625,23 +625,16 @@ void x264_macroblock_encode( x264_t *h )
             h->mb.i_cbp_chroma = 0x02;    /* dc+ac (we can't do only ac) */
         }
     }
-    if( h->mb.i_cbp_chroma == 0x00 &&
-        ( array_non_zero_count( h->dct.chroma_dc[0], 4 ) > 0 || array_non_zero_count( h->dct.chroma_dc[1], 4 ) ) > 0 )
+    if( h->mb.i_cbp_chroma == 0x00 && array_non_zero( h->dct.chroma_dc[0], 8 ) )
     {
         h->mb.i_cbp_chroma = 0x01;    /* dc only */
     }
 
     if( h->param.b_cabac )
     {
-        if( h->mb.i_type == I_16x16 && array_non_zero_count( h->dct.luma16x16_dc, 16 ) > 0 )
-            i_cbp_dc = 0x01;
-        else
-            i_cbp_dc = 0x00;
-
-        if( array_non_zero_count( h->dct.chroma_dc[0], 4 ) > 0 )
-            i_cbp_dc |= 0x02;
-        if( array_non_zero_count( h->dct.chroma_dc[1], 4 ) > 0 )
-            i_cbp_dc |= 0x04;
+        i_cbp_dc = ( h->mb.i_type == I_16x16 && array_non_zero( h->dct.luma16x16_dc, 16 ) )
+                 | array_non_zero( h->dct.chroma_dc[0], 4 ) << 1
+                 | array_non_zero( h->dct.chroma_dc[1], 4 ) << 2;
     }
 
     /* store cbp */