[opengtl-commits] [351] add a raw to color kernel

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 351
Author:   cyrille
Date:     2008-09-02 08:51:00 +0200 (Tue, 02 Sep 2008)

Log Message:
-----------
add a raw to color kernel

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/tests/raw/RawToGray.shiva

Added Paths:
-----------
    trunk/OpenGTL/OpenShiva/tests/raw/RawToColor.shiva


Added: trunk/OpenGTL/OpenShiva/tests/raw/RawToColor.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/RawToColor.shiva	                        (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/raw/RawToColor.shiva	2008-09-02 06:51:00 UTC (rev 351)
@@ -0,0 +1,30 @@
+kernel RawToColor
+{
+  void evaluatePixel(image1 img, out pixel4 result)
+  {
+    float v = img.sampleNearest( result.coord );
+    int x = result.coord[0];
+    int y = result.coord[1];
+    int index = 0;
+    if( x & 1 )
+    {
+      if( y & 1 )
+      {
+        index = 1;
+      } else {
+        index = 2;
+      }
+    } else {
+      if( y & 1 )
+      {
+        index = 0;
+      } else {
+        index = 1;
+      }
+    }
+    
+    result.data = 0.0;
+    result.data[index] = v;
+    result.data[3] = 1.0;
+  }
+}

Modified: trunk/OpenGTL/OpenShiva/tests/raw/RawToGray.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/RawToGray.shiva	2008-09-02 06:33:55 UTC (rev 350)
+++ trunk/OpenGTL/OpenShiva/tests/raw/RawToGray.shiva	2008-09-02 06:51:00 UTC (rev 351)
@@ -1,4 +1,4 @@
-kernel Copy
+kernel RawToGray
 {
   void evaluatePixel(image1 img, out pixel4 result)
   {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/