[MPlayer-dev-eng] [PATCH] combined patch for ve_xvid4.c

Edouard Gomez ed.gomez at free.fr
Sat Jan 3 19:01:54 CET 2004


Nico (nsabbi at tiscali.it) wrote:
> can  you  please review  it  and  eventually  merge the  two,  please?

Sure.

Merged  upstream,  attached  patch  combines your  contribution  and  my
previous patch.

I have just  done some cosmetic changes to the  DAR/PAR "if" blocks, and
initialized dar  to 0.0f  as NULL isn't  always == (int)0  (compiler may
warn about incompatible types).

-- 
Edouard Gomez
-------------- next part --------------
Index: libmpcodecs/ve_xvid4.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_xvid4.c,v
retrieving revision 1.3
diff -u -r1.3 ve_xvid4.c
--- libmpcodecs/ve_xvid4.c	8 Dec 2003 16:56:46 -0000	1.3
+++ libmpcodecs/ve_xvid4.c	3 Jan 2004 17:54:34 -0000
@@ -67,7 +67,7 @@
 static int xvidenc_pass = 0;
 static float xvidenc_quantizer = 0;
 
-static int xvidenc_packed = 0;
+static int xvidenc_packed = 1;
 static int xvidenc_closed_gop = 1;
 static int xvidenc_interlaced = 0;
 static int xvidenc_quarterpel = 0;
@@ -75,15 +75,17 @@
 static int xvidenc_trellis = 0;
 static int xvidenc_cartoon = 0;
 static int xvidenc_hqacpred = 1;
-static int xvidenc_chromame = 0;
-static int xvidenc_vhq = 0;
+static int xvidenc_chromame = 1;
+static int xvidenc_chroma_opt = 0;
+static int xvidenc_vhq = 1;
 static int xvidenc_motion = 6;
+static int xvidenc_turbo = 0;
 static int xvidenc_stats = 0;
-static int xvidenc_max_key_interval = 0;
+static int xvidenc_max_key_interval = 0; /* Let xvidcore set a 10s interval by default */
 static int xvidenc_frame_drop_ratio = 0;
 static int xvidenc_greyscale = 0;
 
-static int xvidenc_max_bframes = 0;
+static int xvidenc_max_bframes = 2;
 static int xvidenc_bquant_ratio = 150;
 static int xvidenc_bquant_offset = 100;
 static int xvidenc_bframe_threshold = 0;
@@ -99,18 +101,19 @@
 static int xvidenc_cbr_buffer = 0;
 
 static int xvidenc_vbr_keyframe_boost = 0;
-static int xvidenc_vbr_overflow_control_strength = 0;
+static int xvidenc_vbr_overflow_control_strength = 5;
 static int xvidenc_vbr_curve_compression_high = 0;
 static int xvidenc_vbr_curve_compression_low = 0;
-static int xvidenc_vbr_max_overflow_improvement = 0;
-static int xvidenc_vbr_max_overflow_degradation = 0;
+static int xvidenc_vbr_max_overflow_improvement = 5;
+static int xvidenc_vbr_max_overflow_degradation = 5;
 static int xvidenc_vbr_kfreduction = 0;
 static int xvidenc_vbr_kfthreshold = 0;
-static int xvidenc_vbr_container_frame_overhead = 0;
+static int xvidenc_vbr_container_frame_overhead = 24; /* mencoder uses AVI container */
 
 static char *xvidenc_par = NULL;
 static int xvidenc_par_width = 0;
 static int xvidenc_par_height = 0;
+static float xvidenc_dar_aspect = 0.0f;
 
 m_option_t xvidencopts_conf[] =
 {
@@ -123,6 +126,7 @@
 	{"quant_type", &xvidenc_quant_method, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"me_quality", &xvidenc_motion, CONF_TYPE_INT, CONF_RANGE, 0, 6, NULL},
 	{"chroma_me", &xvidenc_chromame, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"chroma_opt", &xvidenc_chroma_opt, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"vhq", &xvidenc_vhq, CONF_TYPE_INT, CONF_RANGE, 0, 4, NULL},
 	{"max_bframes", &xvidenc_max_bframes, CONF_TYPE_INT, CONF_RANGE, 0, 20, NULL},
 	{"bquant_ratio", &xvidenc_bquant_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 200, NULL},
@@ -139,6 +143,7 @@
 	{"frame_drop_ratio", &xvidenc_frame_drop_ratio, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
 	{"max_key_interval", &xvidenc_max_key_interval, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
 	{"greyscale", &xvidenc_greyscale, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+	{"turbo", &xvidenc_turbo, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 	{"stats", &xvidenc_stats, CONF_TYPE_FLAG, 0, 0, 1, NULL},
 
 
@@ -172,6 +177,7 @@
 	{"par", &xvidenc_par, CONF_TYPE_STRING, 0, 0, 0, NULL},
 	{"par_width", &xvidenc_par_width, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
 	{"par_height", &xvidenc_par_height, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL},
+	{"aspect", &xvidenc_dar_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
 
 	/* End of the config array */
 	{NULL, 0, 0, 0, 0, 0, NULL}
@@ -652,6 +658,9 @@
 	if(xvidenc_hqacpred) {
 		frame->vop_flags |= XVID_VOP_HQACPRED;
 	}
+	if(xvidenc_chroma_opt) {
+		frame->vop_flags |= XVID_VOP_CHROMAOPT;
+	}
 	if(xvidenc_motion > 4) {
 		frame->vop_flags |= XVID_VOP_INTER4V;
 	}
@@ -674,6 +683,13 @@
 	if(xvidenc_vhq >= 4) {
 		frame->motion |= XVID_ME_EXTSEARCH_RD;
 	}
+	if(xvidenc_turbo) {
+		frame->motion |= XVID_ME_FASTREFINE16;
+		frame->motion |= XVID_ME_FASTREFINE8;
+		frame->motion |= XVID_ME_SKIP_DELTASEARCH;
+		frame->motion |= XVID_ME_FAST_MODEINTERPOLATE;
+		frame->motion |= XVID_ME_BFRAME_EARLYSTOP;
+	}
 
 	/* motion level == 0 means no motion search which is equivalent to
 	 * intra coding only */
@@ -685,34 +701,42 @@
 
 	frame->bframe_threshold = xvidenc_bframe_threshold;
 
-	frame->par = 0;
-	if(xvidenc_par != NULL) {
+	/* PAR related initialization */
+	frame->par = XVID_PAR_11_VGA; /* Default */
+
+	if(xvidenc_dar_aspect > 0) {
+		int dar_x, dar_y;
+
+		dar_x = (int)(xvidenc_dar_aspect * 100.0f);
+		dar_y = 100;
+
+		frame->par = XVID_PAR_EXT;
+		frame->par_width = (100 * mod->mux->bih->biHeight) / dar_y;
+		frame->par_height= (100 * mod->mux->bih->biWidth) / dar_x;
+	} else if(xvidenc_par != NULL) {
 		if(strcasecmp(xvidenc_par, "pal43") == 0)
 			frame->par = XVID_PAR_43_PAL;
-		if(strcasecmp(xvidenc_par, "pal169") == 0)
+		else if(strcasecmp(xvidenc_par, "pal169") == 0)
 			frame->par = XVID_PAR_169_PAL;
-		if(strcasecmp(xvidenc_par, "ntsc43") == 0)
+		else if(strcasecmp(xvidenc_par, "ntsc43") == 0)
 			frame->par = XVID_PAR_43_NTSC;
-		if(strcasecmp(xvidenc_par, "ntsc169") == 0)
+		else if(strcasecmp(xvidenc_par, "ntsc169") == 0)
 			frame->par = XVID_PAR_169_NTSC;
-		if(strcasecmp(xvidenc_par, "ext") == 0)
+		else if(strcasecmp(xvidenc_par, "ext") == 0)
 			frame->par = XVID_PAR_EXT;
-	}
-	if(frame->par == 0) {
-		frame->par = XVID_PAR_11_VGA;
-	}
-	if(frame->par == XVID_PAR_EXT) {
-		if(xvidenc_par_width)
-			frame->par_width = xvidenc_par_width;
-		else
-			frame->par_width = 1;
-
-		if(xvidenc_par_height)
-			frame->par_height = xvidenc_par_height;
-		else
-			frame->par_height = 1;
-	}
 
+		if(frame->par == XVID_PAR_EXT) {
+			if(xvidenc_par_width)
+				frame->par_width = xvidenc_par_width;
+			else
+				frame->par_width = 1;
+
+			if(xvidenc_par_height)
+				frame->par_height = xvidenc_par_height;
+			else
+				frame->par_height = 1;
+		}
+	}
 	return;
 }
 


More information about the MPlayer-dev-eng mailing list