Changeset 7537


Ignore:
Timestamp:
01/14/11 10:48:46 (9 years ago)
Author:
rlentz
Message:

changed the implementation to floating point

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/maven/projects/opencl-decon/src/demos/sobel.cl

    r7533 r7537  
    1 #pragma OPENCL EXTENSION cl_khr_fp64: enable 
     1//#pragma OPENCL EXTENSION cl_khr_fp64: enable 
    22__kernel void sobel( __global float* input, 
    33        __global float* output, 
     
    77    int x = get_global_id(0); 
    88    int y = get_global_id(1); 
     9    int offset = y * width + x; 
     10     
    911    float p0, p1, p2, p3, p5, p6, p7, p8 = 0; 
    10     int offset = y * width + x; 
     12     
    1113     
    1214        if( x < 1 || y < 1 || x > width - 2 || y > height - 2 ) 
     
    2527            p8 = input[offset + width + 1] ; 
    2628         
    27             double sum1 = p0 + 2*p1 + p2 - p6 - 2*p7 - p8;  //GY 
    28             double sum2 = p0 + 2*p3 + p6 - p2 - 2*p5 - p8;  //GX 
     29                // you can use double here 
     30            float sum1 = p0 + 2*p1 + p2 - p6 - 2*p7 - p8;  //GY 
     31            float sum2 = p0 + 2*p3 + p6 - p2 - 2*p5 - p8;  //GX 
    2932            
    3033            output[offset] = sqrt(  sum1*sum1 + sum2*sum2 ); 
    3134        } 
    32 } 
     35}  
Note: See TracChangeset for help on using the changeset viewer.