changeset 8870:7538bf7e728d

halfpack now takes an optional argument, field, which tells it to keep only even lines (if 0) or only odd lines (if 1) rather than averaging pairs of lines. this may be useful for slightly improving performance or for dirty deinterlacing.
author rfelker
date Fri, 10 Jan 2003 14:12:07 +0000
parents 9df3c03b2ffe
children 2f487fc23e43
files libmpcodecs/vf_halfpack.c
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_halfpack.c	Fri Jan 10 10:43:01 2003 +0000
+++ b/libmpcodecs/vf_halfpack.c	Fri Jan 10 14:12:07 2003 +0000
@@ -14,6 +14,9 @@
 #include "../libvo/fastmemcpy.h"
 #include "../postproc/rgb2rgb.h"
 
+struct vf_priv_s {
+	int field;
+};
 
 #ifdef HAVE_MMX
 static void halfpack_MMX(unsigned char *dst, unsigned char *src[3],
@@ -149,9 +152,17 @@
 			  MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE,
 			  mpi->w, mpi->h/2);
 
-	halfpack(dmpi->planes[0], mpi->planes,
-		 dmpi->stride[0], mpi->stride,
-		 mpi->w, mpi->h);
+	switch(vf->priv->field) {
+	case 0:
+	case 1:
+		yuv422ptoyuy2(mpi->planes[0] + mpi->stride[0]*vf->priv->field,
+			mpi->planes[1], mpi->planes[2], dmpi->planes[0],
+			mpi->w, mpi->h/2, mpi->stride[0]*2, mpi->stride[1], dmpi->stride[0]);
+		break;
+	default:
+		halfpack(dmpi->planes[0], mpi->planes, dmpi->stride[0],
+			mpi->stride, mpi->w, mpi->h);
+	}
 
 	return vf_next_put_image(vf,dmpi);
 }
@@ -177,12 +188,22 @@
 	return 0;
 }
 
+static void uninit(struct vf_instance_s* vf)
+{
+	free(vf->priv);
+}
 
 static int open(vf_instance_t *vf, char* args)
 {
 	vf->config=config;
 	vf->query_format=query_format;
 	vf->put_image=put_image;
+	vf->uninit=uninit;
+	
+	vf->priv = calloc(1, sizeof (struct vf_priv_s));
+	vf->priv->field = 2;
+	if (args) sscanf(args, "%d", &vf->priv->field);
+	
 	halfpack = halfpack_C;
 #ifdef HAVE_MMX
 	if(gCpuCaps.hasMMX) halfpack = halfpack_MMX;