changeset 5778:f2586f1a3a96

support for new stuff (lavc internal 2pass, ...)
author michael
date Sun, 21 Apr 2002 21:38:53 +0000
parents 578a48174545
children 6c453e75e78f
files libmpcodecs/ve_lavc.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ve_lavc.c	Sun Apr 21 21:18:28 2002 +0000
+++ b/libmpcodecs/ve_lavc.c	Sun Apr 21 21:38:53 2002 +0000
@@ -33,6 +33,10 @@
 #include "libavcodec/avcodec.h"
 #endif
 
+#if LIBAVCODEC_BUILD < 4601
+#error your version of libavcodec is too old, get a newer one, and dont send a bugreport, THIS IS NO BUG
+#endif
+
 extern int avcodec_inited;
 
 /* video options */
@@ -48,8 +52,12 @@
 static int lavc_param_vqdiff = 3;
 static float lavc_param_vqcompress = 0.5;
 static float lavc_param_vqblur = 0.5;
+static float lavc_param_vb_qfactor = 2.0;
 static int lavc_param_vmax_b_frames = 0;
 static int lavc_param_keyint = -1;
+static int lavc_param_vpass = 0;
+static int lavc_param_vrc_strategy = 2;
+static int lavc_param_vb_strategy = 0;
 
 #include "cfgparser.h"
 
@@ -67,7 +75,11 @@
 	{"vqdiff", &lavc_param_vqdiff, CONF_TYPE_INT, CONF_RANGE, 1, 31, NULL},
 	{"vqcomp", &lavc_param_vqcompress, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL},
 	{"vqblur", &lavc_param_vqblur, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 1.0, NULL},
+	{"vb_qfactor", &lavc_param_vb_qfactor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 31.0, NULL},
 	{"vmax_b_frames", &lavc_param_vmax_b_frames, CONF_TYPE_INT, CONF_RANGE, 0, FF_MAX_B_FRAMES, NULL},
+	{"vpass", &lavc_param_vpass, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+	{"vrc_strategy", &lavc_param_vrc_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL},
+	{"vb_strategy", &lavc_param_vb_strategy, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
 	{"keyint", &lavc_param_keyint, CONF_TYPE_INT, 0, 0, 0, NULL},
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
@@ -112,6 +124,10 @@
     lavc_venc_context.qcompress= lavc_param_vqcompress;
     lavc_venc_context.qblur= lavc_param_vqblur;
     lavc_venc_context.max_b_frames= lavc_param_vmax_b_frames;
+    lavc_venc_context.b_quant_factor= lavc_param_vb_qfactor;
+    lavc_venc_context.rc_strategy= lavc_param_vrc_strategy;
+    lavc_venc_context.b_frame_strategy= lavc_param_vb_strategy;
+    
     /* keyframe interval */
     if (lavc_param_keyint >= 0) /* != -1 */
 	lavc_venc_context.gop_size = lavc_param_keyint;
@@ -128,6 +144,12 @@
 
     lavc_venc_context.flags|= lavc_param_v4mv ? CODEC_FLAG_4MV : 0;
 
+    /* lavc internal 2pass bitrate control */
+    if(lavc_param_vpass==1)
+        lavc_venc_context.flags|= CODEC_FLAG_PASS1;
+    else if(lavc_param_vpass==2)
+        lavc_venc_context.flags|= CODEC_FLAG_PASS2;
+
 #ifdef ME_ZERO
     // workaround Juanjo's stupid incompatible change:
     motion_estimation_method = lavc_param_vme;