[MPlayer-dev-eng] "D" for kerndeint & pp

Carl Eugen Hoyos cehoyos at rainbow.studorg.tuwien.ac.at
Tue Nov 21 00:53:54 CET 2006


Attached are patches to de- and reactivate kerndeint & pp with "D".

Greetings, Carl Eugen
-------------- next part --------------
Index: libmpcodecs/vf_kerndeint.c
===================================================================
--- libmpcodecs/vf_kerndeint.c	(Revision 21115)
+++ libmpcodecs/vf_kerndeint.c	(Arbeitskopie)
@@ -43,6 +43,7 @@
 	int	thresh;
 	int	sharp;
 	int	twoway;
+        int     do_deinterlace;
 };
 
 
@@ -97,11 +98,15 @@
 	int map = vf->priv->map;
 	int sharp = vf->priv->sharp;
 	int twoway = vf->priv->twoway;
+	mp_image_t *dmpi, *pmpi;
 
-	mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
+	if(!vf->priv->do_deinterlace)
+		return vf_next_put_image(vf, mpi, pts);
+
+	dmpi=vf_get_image(vf->next,mpi->imgfmt,
 		MP_IMGTYPE_IP, MP_IMGFLAG_ACCEPT_STRIDE,
 		mpi->w,mpi->h);
-	mp_image_t *pmpi=vf_get_image(vf->next,mpi->imgfmt,
+	pmpi=vf_get_image(vf->next,mpi->imgfmt,
 		MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
 		mpi->w,mpi->h);
 	if(!dmpi) return 0;
@@ -287,8 +292,22 @@
 	return 0;
 }
 
+static int control(struct vf_instance_s* vf, int request, void* data){
+	switch (request)
+	{
+	case VFCTRL_GET_DEINTERLACE:
+		*(int*)data = vf->priv->do_deinterlace;
+		return CONTROL_OK;
+	case VFCTRL_SET_DEINTERLACE:
+		vf->priv->do_deinterlace = *(int*)data;
+		return CONTROL_OK;
+	}
+	return vf_next_control (vf, request, data);
+}
+
 static int open(vf_instance_t *vf, char* args){
 
+	vf->control=control;
 	vf->config=config;
 	vf->put_image=put_image;
         vf->query_format=query_format;
@@ -303,6 +322,7 @@
 	vf->priv->thresh = 10;
 	vf->priv->sharp = 0;
 	vf->priv->twoway = 0;
+	vf->priv->do_deinterlace=1;
 
         if (args)
         {
Index: libmpcodecs/vf_pp.c
===================================================================
--- libmpcodecs/vf_pp.c	(Revision 21115)
+++ libmpcodecs/vf_pp.c	(Arbeitskopie)
@@ -33,6 +33,7 @@
     pp_mode_t *ppMode[PP_QUALITY_MAX+1];
     void *context;
     unsigned int outfmt;
+    int do_deinterlace;
 };
 
 //===========================================================================//
@@ -87,6 +88,12 @@
     case VFCTRL_SET_PP_LEVEL:
 	vf->priv->pp= *((unsigned int*)data);
 	return CONTROL_TRUE;
+    case VFCTRL_GET_DEINTERLACE:
+        *(int*)data = vf->priv->do_deinterlace;
+        return CONTROL_OK;
+    case VFCTRL_SET_DEINTERLACE:
+        vf->priv->do_deinterlace = *(int*)data;
+        return CONTROL_OK;
     }
     return vf_next_control(vf,request,data);
 }
@@ -113,6 +120,8 @@
 }
 
 static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+    if(!vf->priv->do_deinterlace)
+        return vf_next_put_image(vf, mpi, pts);
     if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
 	// no DR, so get a new image! hope we'll get DR buffer:
 	vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -168,6 +177,7 @@
     vf->default_caps=VFCAP_ACCEPT_STRIDE|VFCAP_POSTPROC;
     vf->priv=malloc(sizeof(struct vf_priv_s));
     vf->priv->context=NULL;
+    vf->priv->do_deinterlace=1;
 
     // check csp:
     vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);


More information about the MPlayer-dev-eng mailing list