Commit 9187a8f8 authored by Loren Merritt's avatar Loren Merritt

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
parent d18bbd3b
......@@ -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,
......
......@@ -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 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment