]> granicus.if.org Git - libx264/commitdiff
Faster probe_skip
authorFiona Glaser <fiona@x264.com>
Fri, 27 Mar 2009 05:22:23 +0000 (22:22 -0700)
committerFiona Glaser <fiona@x264.com>
Fri, 27 Mar 2009 06:10:31 +0000 (23:10 -0700)
Add a second chroma threshold after the DC transform.

encoder/macroblock.c

index 61f8765754f1c30eac5e4d12fe04eac4a488f73b..86d452ab265f859deff0aa0f878d0f850839ce13 100644 (file)
@@ -802,7 +802,7 @@ int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
 
     int i_qp = h->mb.i_qp;
     int mvp[2];
-    int ch, thresh;
+    int ch, thresh, ssd;
 
     int i8x8, i4x4;
     int i_decimate_mb;
@@ -856,7 +856,8 @@ int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
 
         /* there is almost never a termination during chroma, but we can't avoid the check entirely */
         /* so instead we check SSD and skip the actual check if the score is low enough. */
-        if( h->pixf.ssd[PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src, FENC_STRIDE ) < thresh )
+        ssd = h->pixf.ssd[PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src, FENC_STRIDE );
+        if( ssd < thresh )
             continue;
 
         h->dctf.sub8x8_dct( dct4x4, p_src, p_dst );
@@ -866,6 +867,10 @@ int x264_macroblock_probe_skip( x264_t *h, int b_bidir )
         if( h->quantf.quant_2x2_dc( dct2x2, h->quant4_mf[CQM_4PC][i_qp][0]>>1, h->quant4_bias[CQM_4PC][i_qp][0]<<1 ) )
             return 0;
 
+        /* If there wasn't a termination in DC, we can check against a much higher threshold. */
+        if( ssd < thresh*4 )
+            continue;
+
         /* calculate dct coeffs */
         for( i4x4 = 0, i_decimate_mb = 0; i4x4 < 4; i4x4++ )
         {