]> git.videolan.org Git - x264.git/commitdiff
Simplify decimate checks in macroblock_encode
authorJason Garrett-Glaser <darkshikari@gmail.com>
Thu, 4 Feb 2010 02:19:29 +0000 (18:19 -0800)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 15 Feb 2010 08:27:51 +0000 (00:27 -0800)
Also fix a misleading comment.

common/common.h
encoder/analyse.c
encoder/macroblock.c

index 950f48f964aaf0f5286021e28072517342d7b91f..8b1b05a5cd0cc61b5be36f1080406ed7adc6527e 100644 (file)
@@ -484,6 +484,7 @@ struct x264_t
         int     b_chroma_me;
         int     b_trellis;
         int     b_noise_reduction;
+        int     b_dct_decimate;
         int     i_psy_rd; /* Psy RD strength--fixed point value*/
         int     i_psy_trellis; /* Psy trellis strength--fixed point value*/
 
index 1fb2206f045eb6ee102bbbdea5083fcf3d29e819..92d6584fb2fae476d5d064af5141f0df0f5865de 100644 (file)
@@ -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.b_chroma_me = h->param.analyse.b_chroma_me && h->sh.i_type == SLICE_TYPE_P
                         && 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_noise_reduction = 0;
index e4edb8adc9beccf46b2fcf36a01a7ba8a36ba82e..fa7942d339de8b95a86810290bba532d16cf786b 100644 (file)
@@ -208,8 +208,7 @@ static void x264_mb_encode_i16x16( x264_t *h, int i_qp )
     ALIGNED_ARRAY_16( int16_t, dct_dc4x4,[16] );
 
     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 = b_decimate ? 0 : 9;
+    int decimate_score = h->mb.b_dct_decimate ? 0 : 9;
 
     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,
 void x264_mb_encode_8x8_chroma( x264_t *h, int b_inter, int i_qp )
 {
     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] );
     h->mb.i_cbp_chroma = 0;
 
@@ -607,7 +606,7 @@ void x264_macroblock_encode( x264_t *h )
 {
     int i_cbp_dc = 0;
     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 i,idx,nz;
     h->mb.i_cbp_luma = 0;
@@ -914,8 +913,7 @@ void x264_macroblock_encode( x264_t *h )
 
 /*****************************************************************************
  * x264_macroblock_probe_skip:
- *  Check if the current MB could be encoded as a [PB]_SKIP (it supposes you use
- *  the previous QP
+ *  Check if the current MB could be encoded as a [PB]_SKIP
  *****************************************************************************/
 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 )
     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_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 ch, nz;