]> granicus.if.org Git - libx264/commitdiff
* encoder: simpler scene cut detection (seems better but do not check
authorLaurent Aimar <fenrir@videolan.org>
Sun, 8 Aug 2004 16:18:49 +0000 (16:18 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 8 Aug 2004 16:18:49 +0000 (16:18 +0000)
size anymore, so need more testing).

git-svn-id: svn://svn.videolan.org/x264/trunk@20 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/encoder.c

index e347e1dec175ee6f33d6690a9131759cc9a93123..4d5a8c76b1096d140a77555fd8b5526a2cdd9103 100644 (file)
@@ -1052,20 +1052,31 @@ do_encode:
 #if 1
     if( i_slice_type != SLICE_TYPE_I)
     {
+        int i_bias;
+
+        int i_mb_i = i_mb_count[I_4x4] + i_mb_count[I_16x16];
+        int i_mb   = h->sps->i_mb_width * h->sps->i_mb_height;
+        if( h->param.i_iframe > 0 )
+            i_bias = 30 * X264_MIN( 3*h->frames.i_last_i, h->param.i_iframe )  / h->param.i_iframe;
+        else
+            i_bias = 15;
+
         /* Bad P will be reencoded as I */
         if( i_slice_type == SLICE_TYPE_P &&
+            100 * i_mb_i >= (100 - i_bias) * i_mb )
+            /*
             h->out.nal[h->out.i_nal-1].i_payload > h->i_last_intra_size +
             h->i_last_intra_size * (3+h->i_last_intra_qp - i_global_qp) / 16 &&
             i_mb_count[I_4x4] + i_mb_count[I_16x16] > i_mb_count[P_SKIP] + i_mb_count[P_L0]/2 &&
             h->out.nal[h->out.i_nal-1].i_payload > 2 * h->i_last_inter_size &&
-            h->frames.i_last_i > 4)
+            h->frames.i_last_i > 4)*/
         {
 
-            fprintf( stderr, "scene cut at %d size=%d last I:%d last P:%d Intra:%d Skip:%d PL0:%d\n",
+            fprintf( stderr, "scene cut at %d size=%d last I:%d last P:%d Intra:%d Inter=%d Ratio=%d Bias=%d (Skip:%d PL0:%d)\n",
                      h->i_frame - 1,
                      h->out.nal[h->out.i_nal-1].i_payload,
                       h->i_last_intra_size, h->i_last_inter_size,
-                     i_mb_count[I_4x4] + i_mb_count[I_16x16],
+                     i_mb_i, i_mb, 100 * i_mb_i / i_mb, i_bias,
                      i_mb_count[P_SKIP],
                      i_mb_count[P_L0] );