[Mplayer-cvslog] CVS: main/libmpcodecs vf_pp.c,1.10,1.11

Michael Niedermayer michael at mplayerhq.hu
Mon Oct 28 20:31:10 CET 2002


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

Modified Files:
	vf_pp.c 
Log Message:
postprocessing cleanup:
remove opendivx #ifdefs
remove rk1 filter
remove unused / obsolete stuff
add -1,4,2,4,-1 deinterlacing filter (ffmpeg uses that)
threadsafe / no more non-const globals
some optimizations
different strides for Y,U,V possible
remove ebx usage (someone really should fix gcc, this is really lame)
change the dering filter slightly (tell me if its worse for any files)



Index: vf_pp.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_pp.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- vf_pp.c	10 Sep 2002 22:18:32 -0000	1.10
+++ vf_pp.c	28 Oct 2002 19:31:04 -0000	1.11
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
 
 #include "../config.h"
 #include "../mp_msg.h"
@@ -12,7 +13,9 @@
 #include "../postproc/postprocess.h"
 
 struct vf_priv_s {
-    unsigned int pp;
+    int pp;
+    PPMode ppMode[GET_PP_QUALITY_MAX+1];
+    void *context;
     mp_image_t *dmpi;
     unsigned int outfmt;
 };
@@ -22,6 +25,10 @@
 static int config(struct vf_instance_s* vf,
         int width, int height, int d_width, int d_height,
 	unsigned int voflags, unsigned int outfmt){
+
+    if(vf->priv->context) freePPContext(vf->priv->context);
+    vf->priv->context= getPPContext(width, height);
+
     return vf_next_config(vf,width,height,d_width,d_height,voflags,vf->priv->outfmt);
 }
 
@@ -40,7 +47,7 @@
     case VFCTRL_QUERY_MAX_PP_LEVEL:
 	return GET_PP_QUALITY_MAX;
     case VFCTRL_SET_PP_LEVEL:
-	vf->priv->pp=getPpModeForQuality(*((unsigned int*)data));
+	vf->priv->pp= *((unsigned int*)data);
 	return CONTROL_TRUE;
     }
     return vf_next_control(vf,request,data);
@@ -80,11 +87,11 @@
     
     if(vf->priv->pp || !(mpi->flags&MP_IMGFLAG_DIRECT)){
 	// do the postprocessing! (or copy if no DR)
-	postprocess(mpi->planes,mpi->stride[0],
-		    vf->priv->dmpi->planes,vf->priv->dmpi->stride[0],
+	postprocess(mpi->planes           ,mpi->stride,
+		    vf->priv->dmpi->planes,vf->priv->dmpi->stride,
 		    (mpi->w+7)&(~7),mpi->h,
 		    mpi->qscale, mpi->qstride,
-		    vf->priv->pp);
+		    &vf->priv->ppMode[ vf->priv->pp ], vf->priv->context);
     }
     
     return vf_next_put_image(vf,vf->priv->dmpi);
@@ -102,7 +109,10 @@
 };
 
 static int open(vf_instance_t *vf, char* args){
-    char *endptr;
+    char *endptr, *name;
+    int i;
+    int hex_mode=0;
+    
     vf->query_format=query_format;
     vf->control=control;
     vf->config=config;
@@ -116,10 +126,45 @@
     if(!vf->priv->outfmt) return 0; // no csp match :(
     
     if(args){
-	vf->priv->pp=strtol(args, &endptr, 0);
-	if(!(*endptr)) return 1;
+	if(!strcmp("help", args)){
+		printf("%s", postproc_help);
+		exit(1);
+	}
+	
+	hex_mode= strtol(args, &endptr, 0);
+	if(*endptr){
+            name= args;
+	}else
+            name= NULL;
+    }else{
+        name="de";
     }
-    vf->priv->pp=divx_quality;
+    
+    if(name){
+        for(i=0; i<=GET_PP_QUALITY_MAX; i++){
+            vf->priv->ppMode[i]= getPPModeByNameAndQuality(name, i);
+            if(vf->priv->ppMode[i].error) return -1;
+        }
+    }else{
+        /* hex mode for compatibility */
+        for(i=0; i<=GET_PP_QUALITY_MAX; i++){
+	    PPMode ppMode;
+	    
+	    ppMode.lumMode= hex_mode;
+	    ppMode.chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00);
+	    ppMode.maxTmpNoise[0]= 700;
+	    ppMode.maxTmpNoise[1]= 1500;
+	    ppMode.maxTmpNoise[2]= 3000;
+	    ppMode.maxAllowedY= 234;
+	    ppMode.minAllowedY= 16;
+	    ppMode.maxDcDiff= 1;
+	    ppMode.flatnessThreshold=40;
+    
+            vf->priv->ppMode[i]= ppMode;
+        }
+    }
+    
+    vf->priv->pp=GET_PP_QUALITY_MAX; //divx_quality;
     return 1;
 }
 




More information about the MPlayer-cvslog mailing list