[opengtl-commits] [368] add a linear demosaicing |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 368
Author: cyrille
Date: 2008-09-04 01:15:24 +0200 (Thu, 04 Sep 2008)
Log Message:
-----------
add a linear demosaicing
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt
Added Paths:
-----------
trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva
trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva.png
Modified: trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt 2008-09-03 22:49:07 UTC (rev 367)
+++ trunk/OpenGTL/OpenShiva/tests/raw/CMakeLists.txt 2008-09-03 23:15:24 UTC (rev 368)
@@ -3,6 +3,7 @@
RawToColor.shiva
RawToGray.shiva
SimpleDemosaicing.shiva
+ LinearDemosaicing.shiva
)
FOREACH( TEST_FILE ${TESTS_FILES} )
Added: trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva (rev 0)
+++ trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva 2008-09-03 23:15:24 UTC (rev 368)
@@ -0,0 +1,44 @@
+kernel RawToColor
+{
+ float2 coordAdj( float2 v, float h, int idx )
+ {
+ v[idx] = v[ idx ] + h;
+ return v;
+ }
+ void evaluatePixel(image1 img, out pixel4 result)
+ {
+ int x = result.coord[0];
+ int y = result.coord[1];
+ if( x & 1 )
+ {
+ if( y & 1 )
+ {
+ result.data[0] = (img.sampleNearest( coordAdj(result.coord, -1, 0) ) + img.sampleNearest( coordAdj(result.coord, 1, 0) )) * 0.5;
+ result.data[1] = img.sampleNearest( result.coord );
+ result.data[2] = (img.sampleNearest( coordAdj(result.coord, -1, 1) ) + img.sampleNearest( coordAdj(result.coord, 1, 1) )) * 0.5;
+ } else {
+ result.data[0] = (img.sampleNearest( result.coord - 1 ) + img.sampleNearest( result.coord - 1 )) * 0.5;
+ result.data[1] = (img.sampleNearest( coordAdj(result.coord, -1, 0) ) + img.sampleNearest( coordAdj(result.coord, 1, 0) )) * 0.5;
+ result.data[2] = img.sampleNearest( result.coord );
+ }
+ } else {
+ if( y & 1 )
+ {
+ result.data[0] = img.sampleNearest( result.coord );
+ result.data[1] = (img.sampleNearest( coordAdj(result.coord, -1, 0) ) + img.sampleNearest( coordAdj(result.coord, 1, 0) )) * 0.5;
+ result.data[2] = (img.sampleNearest( result.coord - 1) + img.sampleNearest( result.coord + 1)) * 0.5;
+ } else {
+ result.data[0] = (img.sampleNearest( coordAdj(result.coord, -1, 1) ) + img.sampleNearest( coordAdj(result.coord, 1, 1) )) * 0.5;
+ result.data[1] = img.sampleNearest( result.coord );
+ result.data[2] = (img.sampleNearest( coordAdj(result.coord, -1, 0) ) + img.sampleNearest( coordAdj(result.coord, 1, 0) )) * 0.5;
+ }
+ }
+
+ 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/LinearDemosaicing.shiva.png
===================================================================
(Binary files differ)
Property changes on: trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream