Commit fc6bc8c1 authored by Fiona Glaser's avatar Fiona Glaser

Simplify decimate checks in macroblock_encode

Also fix a misleading comment.
parent 29dd5ef2
...@@ -484,6 +484,7 @@ struct x264_t ...@@ -484,6 +484,7 @@ struct x264_t
int b_chroma_me; int b_chroma_me;
int b_trellis; int b_trellis;
int b_noise_reduction; int b_noise_reduction;
int b_dct_decimate;
int i_psy_rd; /* Psy RD strength--fixed point value*/ int i_psy_rd; /* Psy RD strength--fixed point value*/
int i_psy_trellis; /* Psy trellis strength--fixed point value*/ int i_psy_trellis; /* Psy trellis strength--fixed point value*/
......
...@@ -364,6 +364,8 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp ) ...@@ -364,6 +364,8 @@ static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int i_qp )
h->mb.i_subpel_refine = h->param.analyse.i_subpel_refine; h->mb.i_subpel_refine = h->param.analyse.i_subpel_refine;
h->mb.b_chroma_me = h->param.analyse.b_chroma_me && h->sh.i_type == SLICE_TYPE_P h->mb.b_chroma_me = h->param.analyse.b_chroma_me && h->sh.i_type == SLICE_TYPE_P
&& h->mb.i_subpel_refine >= 5; && h->mb.i_subpel_refine >= 5;
h->mb.b_dct_decimate = h->sh.i_type == SLICE_TYPE_B ||
(h->param.analyse.b_dct_decimate && h->sh.i_type != SLICE_TYPE_I);
h->mb.b_transform_8x8 = 0; h->mb.b_transform_8x8 = 0;
h->mb.b_noise_reduction = 0; h->mb.b_noise_reduction = 0;
......
...@@ -208,8 +208,7 @@ static void x264_mb_encode_i16x16( x264_t *h, int i_qp ) ...@@ -208,8 +208,7 @@ static void x264_mb_encode_i16x16( x264_t *h, int i_qp )
ALIGNED_ARRAY_16( int16_t, dct_dc4x4,[16] ); ALIGNED_ARRAY_16( int16_t, dct_dc4x4,[16] );
int i, nz; int i, nz;
int b_decimate = h->sh.i_type == SLICE_TYPE_B || (h->param.analyse.b_dct_decimate && h->sh.i_type == SLICE_TYPE_P); int decimate_score = h->mb.b_dct_decimate ? 0 : 9;
int decimate_score = b_decimate ? 0 : 9;
if( h->mb.b_lossless ) if( h->mb.b_lossless )
{ {
...@@ -342,7 +341,7 @@ static inline int x264_mb_optimize_chroma_dc( x264_t *h, int b_inter, int i_qp, ...@@ -342,7 +341,7 @@ static inline int x264_mb_optimize_chroma_dc( x264_t *h, int b_inter, int i_qp,
void x264_mb_encode_8x8_chroma( x264_t *h, int b_inter, int i_qp ) void x264_mb_encode_8x8_chroma( x264_t *h, int b_inter, int i_qp )
{ {
int i, ch, nz, nz_dc; int i, ch, nz, nz_dc;
int b_decimate = b_inter && (h->sh.i_type == SLICE_TYPE_B || h->param.analyse.b_dct_decimate); int b_decimate = b_inter && h->mb.b_dct_decimate;
ALIGNED_ARRAY_16( int16_t, dct2x2,[4] ); ALIGNED_ARRAY_16( int16_t, dct2x2,[4] );
h->mb.i_cbp_chroma = 0; h->mb.i_cbp_chroma = 0;
...@@ -607,7 +606,7 @@ void x264_macroblock_encode( x264_t *h ) ...@@ -607,7 +606,7 @@ void x264_macroblock_encode( x264_t *h )
{ {
int i_cbp_dc = 0; int i_cbp_dc = 0;
int i_qp = h->mb.i_qp; int i_qp = h->mb.i_qp;
int b_decimate = h->sh.i_type == SLICE_TYPE_B || h->param.analyse.b_dct_decimate; int b_decimate = h->mb.b_dct_decimate;
int b_force_no_skip = 0; int b_force_no_skip = 0;
int i,idx,nz; int i,idx,nz;
h->mb.i_cbp_luma = 0; h->mb.i_cbp_luma = 0;
...@@ -914,8 +913,7 @@ void x264_macroblock_encode( x264_t *h ) ...@@ -914,8 +913,7 @@ void x264_macroblock_encode( x264_t *h )
/***************************************************************************** /*****************************************************************************
* x264_macroblock_probe_skip: * x264_macroblock_probe_skip:
* Check if the current MB could be encoded as a [PB]_SKIP (it supposes you use * Check if the current MB could be encoded as a [PB]_SKIP
* the previous QP
*****************************************************************************/ *****************************************************************************/
int x264_macroblock_probe_skip( x264_t *h, int b_bidir ) int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
{ {
...@@ -1052,7 +1050,7 @@ void x264_macroblock_encode_p8x8( x264_t *h, int i8 ) ...@@ -1052,7 +1050,7 @@ void x264_macroblock_encode_p8x8( x264_t *h, int i8 )
int i_qp = h->mb.i_qp; int i_qp = h->mb.i_qp;
uint8_t *p_fenc = h->mb.pic.p_fenc[0] + (i8&1)*8 + (i8>>1)*8*FENC_STRIDE; uint8_t *p_fenc = h->mb.pic.p_fenc[0] + (i8&1)*8 + (i8>>1)*8*FENC_STRIDE;
uint8_t *p_fdec = h->mb.pic.p_fdec[0] + (i8&1)*8 + (i8>>1)*8*FDEC_STRIDE; uint8_t *p_fdec = h->mb.pic.p_fdec[0] + (i8&1)*8 + (i8>>1)*8*FDEC_STRIDE;
int b_decimate = h->sh.i_type == SLICE_TYPE_B || h->param.analyse.b_dct_decimate; int b_decimate = h->mb.b_dct_decimate;
int nnz8x8 = 0; int nnz8x8 = 0;
int ch, nz; int ch, nz;
......
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