IMG_corr_gen_iq


Detailed Description


Functions

void IMG_corr_gen_iq (const int *restrict x, const short *restrict h, int *restrict y, int m, int pitch, int x_qpt, int h_qpt, int y_qpt)


Function Documentation

void IMG_corr_gen_iq ( const int *restrict  x,
const short *restrict  h,
int *restrict  y,
int  m,
int  pitch,
int  x_qpt,
int  h_qpt,
int  y_qpt 
)

Description:
The routine performs a generalized correlation with a 1 by M tap filter. It can be called N times repetitively to form an arbitrary MxN 2D generalized correlation kernel. Input image data, mask data and output data are all in Q-format as specified by the inputs x_qpt, h_qpt and y_qpt respectively. The input image and output array are both 32-bit data and the mask array is 16-bit. The intermediate correlation sum is accumulated as a 64-bit value in an intermediate Q-format. This sum is shifted to get the final output in the specified output Q-format. For an imput image with 'pitch' columns and a mask of length 'm' the output array must be allocated for at least (pitch - m) elements.
Overflow may occur while accumulating the intermediate sum in 64- bits or while converting the intermediate sum to the final 32-bit sum. In either case, no saturation is performed by the routine.
Parameters:
x Pointer to one row of image pixels
h Pointer to a 16-bit linear (1xM) filter mask
y Output correlation sum(s)
m Length of linear filter (taps)
pitch Number of columns in input image
x_qpt Q-format of input image array
h_qpt Q-format of mask array
y_qpt Q-format of output array
Algorithm:
The natural C implementation has no restrictions. The optimized intrinsic C code has restrictions as noted in Assumptions below.
Assumptions:
  • The input, output and mask arrays should not overlap
  • The input, output and mask arrays should be 64-bit aligned
  • The input and output Q-formats should follow the relation: x_qpt + h_qpt >= y_qpt
  • The length of the filter mask (m) must be a positive multiple of 2
  • The number of columns in the input image (pitch) must satisfy the relation: pitch >= m + 2
  • Internal accuracy of the computations is 64-bit. To ensure correctness on 32-bit input data, the maximum permissible filter gain in terms of bits is 32 (i.e. the cumulative sum of the absolute values of the filter coefficients should not exceed 2^32 - 1)
Implementation Notes:
  • This code is fully interruptible
  • This code is compatible with C66x processors
Benchmarks:
See IMGLIB_Test_Report.html for cycle and memory information.


Copyright 2012, Texas Instruments Incorporated