compress_kernel.c 648 B

1234567891011121314151617
  1. // statistical kernel
  2. __global__ void compress( long d_Ne,
  3. fp *d_I){ // pointer to output image (DEVICE GLOBAL MEMORY)
  4. // indexes
  5. int bx = blockIdx.x; // get current horizontal block index
  6. int tx = threadIdx.x; // get current horizontal thread index
  7. int ei = (bx*NUMBER_THREADS)+tx; // unique thread id, more threads than actual elements !!!
  8. // copy input to output & log uncompress
  9. if(ei<d_Ne){ // do only for the number of elements, omit extra threads
  10. d_I[ei] = log(d_I[ei])*255; // exponentiate input IMAGE and copy to output image
  11. }
  12. }