[Mplayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.17,1.18

Arpi of Ize arpi at mplayerhq.hu
Mon Jul 8 23:34:36 CEST 2002


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv13405

Modified Files:
	ve_lavc.c 
Log Message:
#ifdef'ed divx4 2pass code - idea by Diego

Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ve_lavc.c	18 Jun 2002 01:39:26 -0000	1.17
+++ ve_lavc.c	8 Jul 2002 21:34:24 -0000	1.18
@@ -20,10 +20,12 @@
 #include "mp_image.h"
 #include "vf.h"
 
+#ifdef HAVE_DIVX4ENCORE
 #include "divx4_vbr.h"
+extern char* passtmpfile;
+#endif
 
 extern int pass;
-extern char* passtmpfile;
 
 //===========================================================================//
 
@@ -185,10 +187,14 @@
 
 
     /* 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 HAVE_DIVX4ENCORE
+    switch(lavc_param_vpass){
+#else
+    switch(lavc_param_vpass?lavc_param_vpass:pass){
+#endif
+    case 1: lavc_venc_context.flags|= CODEC_FLAG_PASS1; break;
+    case 2: lavc_venc_context.flags|= CODEC_FLAG_PASS2; break;
+    }
 
 #ifdef ME_ZERO
     // workaround Juanjo's stupid incompatible change:
@@ -205,6 +211,7 @@
 	lavc_venc_context.quality = lavc_param_vqscale;
     }
 
+#ifdef HAVE_DIVX4ENCORE
     switch(pass){
     case 1:
 	if (VbrControl_init_2pass_vbr_analysis(passtmpfile, 5) == -1){
@@ -224,6 +231,7 @@
 	    lavc_venc_context.flags|=CODEC_FLAG_QSCALE|CODEC_FLAG_TYPE; // VBR
 	break;
     }
+#endif
 
     if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
 	mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec);
@@ -264,6 +272,7 @@
     lavc_venc_picture.linesize[1]=mpi->stride[1];
     lavc_venc_picture.linesize[2]=mpi->stride[2];
 
+#ifdef HAVE_DIVX4ENCORE
     if(pass==2){ // handle 2-pass:
 	lavc_venc_context.flags|=CODEC_FLAG_QSCALE; // enable VBR
 	lavc_venc_context.quality=VbrControl_get_quant();
@@ -274,17 +283,19 @@
 	VbrControl_update_2pass_vbr_encoding(lavc_venc_context.mv_bits,
 	      lavc_venc_context.i_tex_bits+lavc_venc_context.p_tex_bits,
 	      8*out_size);
-    } else {
+    } else
+#endif
+    {
 	out_size = avcodec_encode_video(&lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
 	    &lavc_venc_picture);
-
+#ifdef HAVE_DIVX4ENCORE
 	if(pass==1){
 	  VbrControl_update_2pass_vbr_analysis(lavc_venc_context.key_frame,
 	      lavc_venc_context.mv_bits,
 	      lavc_venc_context.i_tex_bits+lavc_venc_context.p_tex_bits,
 	      8*out_size, lavc_venc_context.quality);
 	}
-	
+#endif
     }
 
     mencoder_write_chunk(mux_v,out_size,lavc_venc_context.key_frame?0x10:0);
@@ -369,7 +380,7 @@
 vf_info_t ve_info_lavc = {
     "libavcodec encoder",
     "lavc",
-    "A'rpi and Alex",
+    "A'rpi, Alex, Michael",
     "for internal use by mencoder",
     vf_open
 };




More information about the MPlayer-cvslog mailing list