IMG_thr_le2thr_16


Detailed Description


Functions

void IMG_thr_le2thr_16 (const unsigned short *in_data, unsigned short *restrict out_data, short cols, short rows, unsigned short threshold)


Function Documentation

void IMG_thr_le2thr_16 ( const unsigned short *  in_data,
unsigned short *restrict  out_data,
short  cols,
short  rows,
unsigned short  threshold 
)

Description:
This kernel performs a thresholding operation on the input image "in_data" with dimensions as specified by the input arguments "cols" and "rows". The thresholded pixels are written to the output image pointed to by "out_data". The input and output images are of the same dimensions.
Pixels that are above the threshold value are written to the output unmodified. Pixels that are less than or equal to the threshold are set to the threshold value in the output image.
Parameters:
in_data Input image pointer
out_data Output image pointer
cols Number of columns in the image
rows Number of rows in the image
threshold The (unsigned 16-bit) threshold
Algorithm:
The thresholding function is illustrated in the transfer function diagram below:

               65535_|                                                  
                     |                  /                               
                     |                /                                 
            O        |              /                                   
            U        |            /                                     
            T    th _|_________ /                                       
            P        |         .                                        
            U        |         .                                        
            T        |         .                                        
                     |         .                                        
                   0_|_________.__________                              
                     |         |        |                               
                     0        th       65535                            
                                                                      
                             INPUT                                      
   
The main thresholding loop is unrolled sixteen times. Packed-data processing techniques allow us to process all 16 pixels in parallel.
The natural C implementation has no restrictions. The optimized intrinsic C code has restrictions as noted in Assumptions below.
Assumptions:
  • The input array and output array should not overlap
  • Both input and output arrays must be 64-bit aligned
  • The number of image pixels (cols x rows) must be a multiple of 16
Implementation Notes:
  • This code is fully interruptible
  • This code is compatible with C66x processors
  • This code is endian neutral
Benchmarks:
See IMGLIB_Test_Report.html for cycle and memory information.


Copyright 2012, Texas Instruments Incorporated