[opengtl-commits] [408] use all neighbouring pixels |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 408
Author: cyrille
Date: 2008-09-21 08:41:27 +0200 (Sun, 21 Sep 2008)
Log Message:
-----------
use all neighbouring pixels
Modified Paths:
--------------
trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva
trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva.png
Modified: trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva
===================================================================
--- trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva 2008-09-21 00:14:48 UTC (rev 407)
+++ trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva 2008-09-21 06:41:27 UTC (rev 408)
@@ -1,10 +1,7 @@
kernel RawToColor
{
- float2 coordAdj( float2 v, float h, int idx )
- {
- v[idx] = v[ idx ] + h;
- return v;
- }
+ const float2 u_x = { 1, 0 };
+ const float2 u_y = { 0, 1 };
void evaluatePixel(image1 img, out pixel4 result)
{
int x = result.coord[0];
@@ -16,15 +13,15 @@
// B
//RGR
// B
- result.data[0] = (img.sampleNearest( coordAdj(result.coord, -1, 0) ) + img.sampleNearest( coordAdj(result.coord, 1, 0) )) * 0.5;
+ result.data[0] = (img.sampleNearest( result.coord - u_x ) + img.sampleNearest( result.coord + u_x )) * 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;
+ result.data[2] = (img.sampleNearest( result.coord - u_y ) + img.sampleNearest( result.coord + u_y )) * 0.5;
} else {
// R
//GBG
// R
- 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[0] = (img.sampleNearest( result.coord - 1 ) + img.sampleNearest( result.coord - u_x + u_y ) + img.sampleNearest( result.coord + u_x - u_y ) + img.sampleNearest( result.coord + 1 )) * 0.25;
+ result.data[1] = (img.sampleNearest( result.coord - u_x ) + img.sampleNearest( result.coord + u_x )) * 0.5;
result.data[2] = img.sampleNearest( result.coord );
}
} else {
@@ -34,15 +31,15 @@
//GRG
// B
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;
+ result.data[1] = (img.sampleNearest( result.coord - u_x ) + img.sampleNearest( result.coord + u_x ) ) * 0.5;
+ result.data[2] = (img.sampleNearest( result.coord - 1) + img.sampleNearest( result.coord - u_x + u_y ) + img.sampleNearest( result.coord + u_x - u_y ) + img.sampleNearest( result.coord + 1)) * 0.25;
} else {
// R
//BGB
// R
- result.data[0] = (img.sampleNearest( coordAdj(result.coord, -1, 1) ) + img.sampleNearest( coordAdj(result.coord, 1, 1) )) * 0.5;
+ result.data[0] = (img.sampleNearest( result.coord - u_y ) + img.sampleNearest( result.coord + u_y )) * 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[2] = (img.sampleNearest( result.coord - u_x ) + img.sampleNearest( result.coord + u_x )) * 0.5;
}
}
Modified: trunk/OpenGTL/OpenShiva/tests/raw/LinearDemosaicing.shiva.png
===================================================================
(Binary files differ)