1#include "calcfirstder.cl" 2 3__kernel void processNineCellWindow( __global float *scanLine1, 4 __global float *scanLine2, 5 __global float *scanLine3, 6 __global float *resultLine, 7 __global float *rasterParams // mInputNodataValue, mOutputNodataValue, mZFactor, mCellSizeX, mCellSizeY 8 ) 9{ 10 11 // Get the index of the current element 12 const int i = get_global_id(0); 13 14 if ( scanLine2[i+1] == rasterParams[0] ) 15 { 16 resultLine[i] = rasterParams[1]; 17 } 18 else 19 { 20 float derX = calcFirstDer( scanLine1[i], scanLine1[i+1], scanLine1[i+2], 21 scanLine2[i], scanLine2[i+1], scanLine2[i+2], 22 scanLine3[i], scanLine3[i+1], scanLine3[i+2], 23 rasterParams[0], rasterParams[1], rasterParams[2], rasterParams[3] ); 24 25 float derY = calcFirstDer( scanLine3[i], scanLine2[i], scanLine1[i], 26 scanLine3[i+1], scanLine2[i+1], scanLine1[i+1], 27 scanLine3[i+2], scanLine2[i+2], scanLine1[i+2], 28 rasterParams[0], rasterParams[1], rasterParams[2], rasterParams[4]); 29 30 31 if ( derX == rasterParams[1] || derY == rasterParams[1] ) 32 { 33 resultLine[i] = rasterParams[1]; 34 } 35 else 36 { 37 float res = sqrt( derX * derX + derY * derY ); 38 res = atanpi( res ); 39 resultLine[i] = res * 180.0f; 40 } 41 } 42} 43