[Mplayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.71,1.72

Alex Beregszaszi alex at mplayerhq.hu
Mon Sep 1 16:05:08 CEST 2003


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

Modified Files:
	ve_lavc.c 
Log Message:
support for user specified intra/inter matrices

Index: ve_lavc.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- ve_lavc.c	1 Sep 2003 13:26:05 -0000	1.71
+++ ve_lavc.c	1 Sep 2003 14:04:41 -0000	1.72
@@ -127,6 +127,8 @@
 #endif
 static int lavc_param_coder= 0;
 static int lavc_param_context= 0;
+static char *lavc_param_intra_matrix = NULL;
+static char *lavc_param_inter_matrix = NULL;
 
 #include "m_option.h"
 
@@ -218,6 +220,10 @@
 	{"coder", &lavc_param_coder, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
 	{"context", &lavc_param_context, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
 #endif
+#if LIBAVCODEC_BUILD >= 4675
+	{"intra_matrix", &lavc_param_intra_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL},
+	{"inter_matrix", &lavc_param_inter_matrix, CONF_TYPE_STRING, 0, 0, 0, NULL},
+#endif
 	{NULL, NULL, 0, 0, 0, 0, NULL}
 };
 #endif
@@ -320,6 +326,54 @@
     lavc_venc_context->coder_type= lavc_param_coder;
     lavc_venc_context->context_model= lavc_param_context;
 #endif
+#if LIBAVCODEC_BUILD >= 4675
+    if (lavc_param_intra_matrix)
+    {
+	char *tmp;
+
+	lavc_venc_context->intra_matrix =
+	    malloc(sizeof(*lavc_venc_context->intra_matrix)*64);
+
+	i = 0;
+	while ((tmp = strsep(&lavc_param_intra_matrix, ",")) && (i < 64))
+	{
+	    if (!tmp || (tmp && !strlen(tmp)))
+		break;
+	    lavc_venc_context->intra_matrix[i++] = atoi(tmp);
+	}
+	
+	if (i != 64)
+	{
+	    free(lavc_venc_context->intra_matrix);
+	    lavc_venc_context->intra_matrix = NULL;
+	}
+	else
+	    mp_msg(MSGT_MENCODER, MSGL_V, "Using user specified intra matrix\n");
+    }
+    if (lavc_param_inter_matrix)
+    {
+	char *tmp;
+
+	lavc_venc_context->inter_matrix =
+	    malloc(sizeof(*lavc_venc_context->inter_matrix)*64);
+
+	i = 0;
+	while ((tmp = strsep(&lavc_param_inter_matrix, ",")) && (i < 64))
+	{
+	    if (!tmp || (tmp && !strlen(tmp)))
+		break;
+	    lavc_venc_context->inter_matrix[i++] = atoi(tmp);
+	}
+	
+	if (i != 64)
+	{
+	    free(lavc_venc_context->inter_matrix);
+	    lavc_venc_context->inter_matrix = NULL;
+	}
+	else
+	    mp_msg(MSGT_MENCODER, MSGL_V, "Using user specified inter matrix\n");
+    }
+#endif
 
     p= lavc_param_rc_override_string;
     for(i=0; p; i++){
@@ -648,6 +702,15 @@
             psnr((lavc_venc_context->error[0]+lavc_venc_context->error[1]+lavc_venc_context->error[2])/(f*1.5))
             );
     }
+#endif
+
+#if LIBAVCODEC_BUILD >= 4675
+    if (lavc_venc_context->intra_matrix)
+	free(lavc_venc_context->intra_matrix);
+    lavc_venc_context->intra_matrix = NULL;
+    if (lavc_venc_context->inter_matrix)
+	free(lavc_venc_context->inter_matrix);
+    lavc_venc_context->inter_matrix = NULL;
 #endif
 
     avcodec_close(lavc_venc_context);



More information about the MPlayer-cvslog mailing list