[xiph-commits] r3839 - liboggplay/trunk/src/liboggplay

wiking at svn.annodex.net wiking at svn.annodex.net
Thu Jan 15 16:31:19 PST 2009


Author: wiking
Date: 2009-01-15 16:31:18 -0800 (Thu, 15 Jan 2009)
New Revision: 3839

Modified:
   liboggplay/trunk/src/liboggplay/oggplay_yuv2rgb.c
Log:
fix yuv2rgb vanilla implementation


Modified: liboggplay/trunk/src/liboggplay/oggplay_yuv2rgb.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_yuv2rgb.c	2009-01-15 06:28:16 UTC (rev 3838)
+++ liboggplay/trunk/src/liboggplay/oggplay_yuv2rgb.c	2009-01-16 00:31:18 UTC (rev 3839)
@@ -361,29 +361,27 @@
     ptro2 = ptro;
     for (j = 0; j < yuv->y_width; j += 2) {
 
-      short pr, pg, pb;
+      short pr, pg, pb, y;
       short r, g, b;
 
-    //pr = ((128 + (ptrv[j/2] - 128) * 292) >> 8) - 16; /* 1.14 * 256 */
-      pr = (-41344 + ptrv[j/2] * 292) >> 8;
-    //pg = ((128 - (ptru[j/2] - 128) * 101 - (ptrv[j/2] - 128) * 149) >> 8)-16;
-    //                                /* 0.395 & 0.581 */
-      pg = (28032 - ptru[j/2] * 101 - ptrv[j/2] * 149) >> 8;
-    //pb = ((128 + (ptru[j/2] - 128) * 520) >> 8) - 16; /* 2.032 */
-      pb = (-70528 + ptru[j/2] * 520) >> 8;
+      pr = (-56992 + ptrv[j/2] * 409) >> 8;
+      pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
+      pb = (-70688 + ptru[j/2] * 516) >> 8;
 
-      r = ptry[j] + pr;
-      g = ptry[j] + pg;
-      b = ptry[j] + pb;
+      y = 298*ptry[j] >> 8;
+      r = y + pr;
+      g = y + pg;
+      b = y + pb;
 
       *ptro2++ = CLAMP(r);
       *ptro2++ = CLAMP(g);
       *ptro2++ = CLAMP(b);
       *ptro2++ = 255;
 
-      r = ptry[j + 1] + pr;
-      g = ptry[j + 1] + pg;
-      b = ptry[j + 1] + pb;
+      y = 298*ptry[j + 1] >> 8;
+      r = y + pr;
+      g = y + pg;
+      b = y + pb;
 
       *ptro2++ = CLAMP(r);
       *ptro2++ = CLAMP(g);
@@ -413,29 +411,27 @@
     ptro2 = ptro;
     for (j = 0; j < yuv->y_width; j += 2) {
 
-      short pr, pg, pb;
+      short pr, pg, pb, y;
       short r, g, b;
 
-    //pr = ((128 + (ptrv[j/2] - 128) * 292) >> 8) - 16; /* 1.14 * 256 */
-      pr = (-41344 + ptrv[j/2] * 292) >> 8;
-    //pg = ((128 - (ptru[j/2] - 128) * 101 - (ptrv[j/2] - 128) * 149) >> 8)-16;
-    //                                /* 0.395 & 0.581 */
-      pg = (28032 - ptru[j/2] * 101 - ptrv[j/2] * 149) >> 8;
-    //pb = ((128 + (ptru[j/2] - 128) * 520) >> 8) - 16; /* 2.032 */
-      pb = (-70528 + ptru[j/2] * 520) >> 8;
+      pr = (-56992 + ptrv[j/2] * 409) >> 8;
+      pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
+      pb = (-70688 + ptru[j/2] * 516) >> 8;
 
-      r = ptry[j] + pr;
-      g = ptry[j] + pg;
-      b = ptry[j] + pb;
+      y = 298*ptry[j] >> 8;
+      r = y + pr;
+      g = y + pg;
+      b = y + pb;
 
       *ptro2++ = CLAMP(b);
       *ptro2++ = CLAMP(g);
       *ptro2++ = CLAMP(r);
       *ptro2++ = 255;
 
-      r = ptry[j + 1] + pr;
-      g = ptry[j + 1] + pg;
-      b = ptry[j + 1] + pb;
+      y = 298*ptry[j + 1] >> 8;
+      r = y + pr;
+      g = y + pg;
+      b = y + pb;
 
       *ptro2++ = CLAMP(b);
       *ptro2++ = CLAMP(g);



More information about the commits mailing list