[PD-cvs] SF.net SVN: pure-data: [9976] branches/pd-extended/v0-40/externals/pdp

sevyves at users.sourceforge.net sevyves at users.sourceforge.net
Sun Jun 8 13:55:43 CEST 2008


Revision: 9976
          http://pure-data.svn.sourceforge.net/pure-data/?rev=9976&view=rev
Author:   sevyves
Date:     2008-06-08 04:55:43 -0700 (Sun, 08 Jun 2008)

Log Message:
-----------
Patch to support more conversion

Modified Paths:
--------------
    branches/pd-extended/v0-40/externals/pdp/include/pdp_llconv.h
    branches/pd-extended/v0-40/externals/pdp/system/image/pdp_llconv.c

Modified: branches/pd-extended/v0-40/externals/pdp/include/pdp_llconv.h
===================================================================
--- branches/pd-extended/v0-40/externals/pdp/include/pdp_llconv.h	2008-06-08 11:49:52 UTC (rev 9975)
+++ branches/pd-extended/v0-40/externals/pdp/include/pdp_llconv.h	2008-06-08 11:55:43 UTC (rev 9976)
@@ -53,6 +53,7 @@
 	RIF_YUV__P411_U8,
 	RIF_YVU__P411_S16,
 	RIF_YVU__P444_S16,
+	RIF_UYVY_P____U8,
 	RIF_YUYV_P____U8,
         RIF_RGB__P____U8,
 	RIF_RGBA_P____U8,

Modified: branches/pd-extended/v0-40/externals/pdp/system/image/pdp_llconv.c
===================================================================
--- branches/pd-extended/v0-40/externals/pdp/system/image/pdp_llconv.c	2008-06-08 11:49:52 UTC (rev 9975)
+++ branches/pd-extended/v0-40/externals/pdp/system/image/pdp_llconv.c	2008-06-08 11:55:43 UTC (rev 9976)
@@ -509,6 +509,66 @@
 
 }
 
+
+
+/* convert yuvu packed 8 bit unsigned to yv12 planar 16bit signed */
+/* search for bithacks */
+static void llconv_uyvy_packed_u8s16(unsigned char* ucsource, short int *sidest, unsigned int w, unsigned int h)
+{
+    unsigned int i, j;
+    unsigned int *source = (unsigned int *)ucsource;
+
+    unsigned int *dest = (unsigned int *)sidest;
+    unsigned int uoffset = (w*h)>>1;
+    unsigned int voffset = (w*h + ((w*h) >> 2)) >> 1;
+
+    for(j=0; j < (h*w)>>1; j +=(w)){
+	for(i=0; i< (w>>1); i+=2){
+	    unsigned int y,u,v;
+	    unsigned int v00, v01, v10, v11;
+	    v00 = source[i+j];
+	    v01 = source[i+j+1];
+	    v10 = source[i+j+(w>>1)];
+	    v11 = source[i+j+(w>>1)+1];
+	    
+	    // save luma
+	    dest[i+j]          = ((v00 & 0xff00ff00)>>1);
+	    v11 = source[i+j+(w>>1)+1];
+	    
+	    // save luma
+	    dest[i+j]          = ((v00 & 0xff00ff00)>>1);
+	    dest[i+j+1]        = ((v01 & 0xff00ff00)>>1);
+	    dest[i+j+(w>>1)]   = ((v10 & 0xff00ff00)>>1);
+	    dest[i+j+(w>>1)+1] = ((v11 & 0xff00ff00)>>1);
+
+	    // compute chroma
+
+	    
+	    v00 = (v00 & 0x00ff00ff) << 7;
+	    v01 = (v01 & 0x00ff00ff) << 7;
+	    v10 = (v10 & 0x00ff00ff) << 7;
+	    v11 = (v11 & 0x00ff00ff) << 7;
+	    
+	    // average 2 scan lines
+	    v00 += v10;
+	    v01 += v11;
+
+	    // combine TWO VALUES IN ONE WORD (32bits) 
+	    v = (v01 << 16) | (v00 & 0x0000ffff);
+	    u = (v01 & 0xffff0000) | (v00 >> 16);
+
+	    // flip sign bits for u,v FOR PDP FORMAT
+	    u ^= 0x80008000;
+	    v ^= 0x80008000;
+
+	    // save chroma
+	    dest[uoffset + (i>>1) + (j>>2)] = u;
+	    dest[voffset + (i>>1) + (j>>2)] = v;
+	}
+    }
+
+}
+
 #define CONVERT(x,y) ((x) + ((y)<<16))
 
 void pdp_llconv(void *src, int stype, void *dst, int dtype, int w, int h)
@@ -530,6 +590,10 @@
 	llconv_yuyv_packed_u8s16((unsigned char*)src, (short int *)dst, w, h);
 	break;
 
+    case CONVERT( RIF_UYVY_P____U8, RIF_YVU__P411_S16 ):
+	llconv_uyvy_packed_u8s16((unsigned char*)src, (short int *)dst, w, h);
+	break;
+
     case CONVERT( RIF_RGB__P____U8, RIF_YVU__P411_U8 ):
 	llconv_rgb2yvu_planar8sub((unsigned char*) src, (unsigned char*) dst, w, h);
 	break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list