From: Loren Merritt Date: Mon, 7 Nov 2005 07:53:42 +0000 (+0000) Subject: use array_non_zero() when we don't need a full array_non_zero_count() X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=9187a8f84ba24b2825487971ce94db404303393d;p=x264.git use array_non_zero() when we don't need a full array_non_zero_count() git-svn-id: svn://svn.videolan.org/x264/trunk@365 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/analyse.c b/encoder/analyse.c index cdf785a4..493228dc 100644 --- a/encoder/analyse.c +++ b/encoder/analyse.c @@ -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, diff --git a/encoder/macroblock.c b/encoder/macroblock.c index 50b9d778..551555e7 100644 --- a/encoder/macroblock.c +++ b/encoder/macroblock.c @@ -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 */