# HG changeset patch
# User corey
# Date 1137963734 0
# Node ID 6770c410f4f3f125d48325bb39db2eb06abab876
# Parent  b56f34ba3f2f48625d4fee1f64dc633bcaee5198
support libavcodec's new sc_factor parameter

Original idea from Michael; patch by me.

diff -r b56f34ba3f2f -r 6770c410f4f3 DOCS/man/en/mplayer.1
--- a/DOCS/man/en/mplayer.1	Sun Jan 22 18:11:35 2006 +0000
+++ b/DOCS/man/en/mplayer.1	Sun Jan 22 21:02:14 2006 +0000
@@ -6831,6 +6831,16 @@
 1000000000 means no scene changes are detected (default: 0).
 .
 .TP
+.B sc_factor=<any positive integer>
+Causes frames with higher quantizers to be more likely to trigger a
+scene change detection and make libavcodec use an I-frame (default: 1).
+1\-16 is a sane range.
+Values between 2 and 6 may yield increasing PSNR (up to approximately
+0.04 dB) and better placement of I-frames in high-motion scenes.
+Higher values than 6 may give very slightly better PSNR (approximately
+0.01 dB more than sc_factor=6), but noticably worse visual quality.
+.
+.TP
 .B vb_strategy=<0\-2> (pass one only)
 strategy to choose between I/\:P/\:B-frames:
 .PD 0
diff -r b56f34ba3f2f -r 6770c410f4f3 libmpcodecs/ve_lavc.c
--- a/libmpcodecs/ve_lavc.c	Sun Jan 22 18:11:35 2006 +0000
+++ b/libmpcodecs/ve_lavc.c	Sun Jan 22 21:02:14 2006 +0000
@@ -158,6 +158,7 @@
 static int lavc_param_turbo = 0;
 static int lavc_param_brd_scale = 0;
 static int lavc_param_bidir_refine = 0;
+static int lavc_param_sc_factor = 1;
 
 
 char *lavc_param_acodec = "mp2";
@@ -314,6 +315,7 @@
 	{"turbo", &lavc_param_turbo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"brd_scale", &lavc_param_brd_scale, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
 	{"bidir_refine", &lavc_param_bidir_refine, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
+	{"sc_factor", &lavc_param_sc_factor, CONF_TYPE_INT, CONF_RANGE, 1, INT_MAX, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -628,6 +630,7 @@
     lavc_venc_context->prediction_method= lavc_param_prediction_method;
     lavc_venc_context->brd_scale = lavc_param_brd_scale;
     lavc_venc_context->bidir_refine = lavc_param_bidir_refine;
+    lavc_venc_context->scenechange_factor = lavc_param_sc_factor;
     switch(lavc_param_format)
     {
 	case IMGFMT_YV12: