Commit ccac553d authored by Loren Merritt's avatar Loren Merritt

compute chroma_qp only once per mb


git-svn-id: svn://svn.videolan.org/x264/trunk@596 df754926-b1dd-0310-bc7b-ec298dee348c
parent 94a4aede
......@@ -506,6 +506,7 @@ struct x264_t
/* */
int i_qp; /* current qp */
int i_chroma_qp;
int i_last_qp; /* last qp */
int i_last_dqp; /* last delta qp */
int b_variable_qp; /* whether qp is allowed to vary per macroblock */
......
......@@ -194,6 +194,7 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
/* conduct the analysis using this lamda and QP */
a->i_qp = h->mb.i_qp = i_qp;
h->mb.i_chroma_qp = i_chroma_qp_table[x264_clip3( i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
a->i_lambda = i_qp0_cost_table[i_qp];
a->i_lambda2 = i_qp0_cost2_table[i_qp];
a->b_mbrd = h->param.analyse.i_subpel_refine >= 6 &&
......@@ -864,8 +865,7 @@ static void x264_intra_rd_refine( x264_t *h, x264_mb_analysis_t *a )
if( i_max > 0 )
{
int i_qp_chroma = i_chroma_qp_table[x264_clip3( h->mb.i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
int i_chroma_lambda = i_qp0_cost2_table[i_qp_chroma];
int i_chroma_lambda = i_qp0_cost2_table[h->mb.i_chroma_qp];
/* the previous thing encoded was x264_intra_rd(), so the pixels and
* coefs for the current chroma mode are still around, so we only
* have to recount the bits. */
......
......@@ -571,7 +571,6 @@ void x264_macroblock_encode( x264_t *h )
}
/* encode chroma */
i_qp = i_chroma_qp_table[x264_clip3( i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
if( IS_INTRA( h->mb.i_type ) )
{
const int i_mode = h->mb.i_chroma_pred_mode;
......@@ -580,7 +579,7 @@ void x264_macroblock_encode( x264_t *h )
}
/* encode the 8x8 blocks */
x264_mb_encode_8x8_chroma( h, !IS_INTRA( h->mb.i_type ), i_qp );
x264_mb_encode_8x8_chroma( h, !IS_INTRA( h->mb.i_type ), h->mb.i_chroma_qp );
/* coded block pattern and non_zero_count */
h->mb.i_cbp_luma = 0x00;
......@@ -707,7 +706,7 @@ int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
}
/* encode chroma */
i_qp = i_chroma_qp_table[x264_clip3( i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
i_qp = h->mb.i_chroma_qp;
for( ch = 0; ch < 2; ch++ )
{
......@@ -875,7 +874,7 @@ void x264_macroblock_encode_p8x8( x264_t *h, int i8 )
}
}
i_qp = i_chroma_qp_table[x264_clip3( i_qp + h->pps->i_chroma_qp_index_offset, 0, 51 )];
i_qp = h->mb.i_chroma_qp;
for( ch = 0; ch < 2; ch++ )
{
......
......@@ -183,7 +183,7 @@ int x264_rd_cost_i8x8_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct )
int i_ssd, i_bits;
if( b_dct )
x264_mb_encode_8x8_chroma( h, 0, h->mb.i_qp );
x264_mb_encode_8x8_chroma( h, 0, h->mb.i_chroma_qp );
i_ssd = ssd_plane( h, PIXEL_8x8, 1, 0, 0 ) +
ssd_plane( h, PIXEL_8x8, 2, 0, 0 );
......
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