[opengtl-commits] [367] add a simple demosaic algorithm |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 367
Author: cyrille
Date: 2008-09-04 00:49:07 +0200 (Thu, 04 Sep 2008)
Log Message:
-----------
add a simple demosaic algorithm
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt
Added Paths:
-----------
trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva
trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva.png
Modified: trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt 2008-09-03 21:22:38 UTC (rev 366)
+++ trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt 2008-09-03 22:49:07 UTC (rev 367)
@@ -2,6 +2,7 @@
set( TESTS_FILES
RawToColor.shiva
RawToGray.shiva
+ SimpleDemosaicing.shiva
)
FOREACH( TEST_FILE ${TESTS_FILES} )
Added: trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva 2008-09-03 22:49:07 UTC (rev 367)
@@ -0,0 +1,51 @@
+kernel RawToColor
+{
+ void evaluatePixel(image1 img, out pixel4 result)
+ {
+ int x = result.coord[0];
+ int y = result.coord[1];
+ float2 redCoord;
+ float2 greenCoord;
+ float2 blueCoord;
+ if( x & 1 )
+ {
+ if( y & 1 )
+ {
+ redCoord[0] = result.coord[0] + 1;
+ redCoord[1] = result.coord[1];
+ greenCoord = result.coord;
+ blueCoord[0] = result.coord[0];
+ blueCoord[1] = result.coord[1] + 1;
+ } else {
+ redCoord = result.coord - 1;
+ greenCoord[0] = result.coord[0] - 1;
+ greenCoord[1] = result.coord[1];
+ blueCoord = result.coord;
+ }
+ } else {
+ if( y & 1 )
+ {
+ redCoord = result.coord;
+ greenCoord[0] = result.coord[0] + 1;
+ greenCoord[1] = result.coord[1];
+ blueCoord = result.coord + 1;
+ } else {
+ redCoord[0] = result.coord[0];
+ redCoord[1] = result.coord[1] + 1;
+ greenCoord = result.coord;
+ blueCoord[0] = result.coord[0] + 1;
+ blueCoord[1] = result.coord[1];
+ }
+ }
+
+ result.data[0] = img.sampleNearest( redCoord );
+ result.data[1] = img.sampleNearest( greenCoord );
+ result.data[2] = img.sampleNearest( blueCoord );
+ result.data[3] = 1.0;
+ }
+ region changed(region changed_input_region, int input_index, region input_DOD[])
+ {
+ return changed_input_region;
+ }
+
+}
Added: trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva.png
===================================================================
(Binary files differ)
Property changes on: trunk/OpenGTL/OpenShiva/tests/raw/SimpleDemosaicing.shiva.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream