diff libmpcodecs/vf_yvu9.c @ 6504:11c0ddb83168

use built-in yvu9->yv12 code, because it requires all src/dst strides and offsets, the params passed to postproc's converter is simply not enough... (temp. solution, waiting for yvu9 support in swscale)
author arpi
date Sat, 22 Jun 2002 23:05:00 +0000
parents 52563321dc78
children 05cd2cf758e4
line wrap: on
line diff
--- a/libmpcodecs/vf_yvu9.c	Sat Jun 22 20:37:30 2002 +0000
+++ b/libmpcodecs/vf_yvu9.c	Sat Jun 22 23:05:00 2002 +0000
@@ -29,16 +29,32 @@
 
 static void put_image(struct vf_instance_s* vf, mp_image_t *mpi){
     mp_image_t *dmpi;
+    int y,w,h;
 
     // hope we'll get DR buffer:
     dmpi=vf_get_image(vf->next,IMGFMT_YV12,
 	MP_IMGTYPE_TEMP, 0/*MP_IMGFLAG_ACCEPT_STRIDE*/,
 	mpi->w, mpi->h);
 
-    yvu9toyv12(mpi->planes[0],mpi->planes[1],mpi->planes[2],
-	    dmpi->planes[0], dmpi->planes[1], dmpi->planes[2], mpi->w, mpi->h,
-	    dmpi->stride[0], dmpi->stride[1]);
-    
+    for(y=0;y<mpi->h;y++)
+	memcpy(dmpi->planes[0]+dmpi->stride[0]*y,
+	       mpi->planes[0]+mpi->stride[0]*y,
+	       mpi->w);
+
+    w=mpi->w/4; h=mpi->h/2;
+    for(y=0;y<h;y++){
+	unsigned char* s=mpi->planes[1]+mpi->stride[1]*(y>>1);
+	unsigned char* d=dmpi->planes[1]+dmpi->stride[1]*y;
+	int x;
+	for(x=0;x<w;x++) d[2*x]=d[2*x+1]=s[x];
+    }
+    for(y=0;y<h;y++){
+	unsigned char* s=mpi->planes[2]+mpi->stride[2]*(y>>1);
+	unsigned char* d=dmpi->planes[2]+dmpi->stride[2]*y;
+	int x;
+	for(x=0;x<w;x++) d[2*x]=d[2*x+1]=s[x];
+    }
+
     dmpi->qscale=mpi->qscale;
     dmpi->qstride=mpi->qstride;