Clear Below Threshold Kernel - Texas Instruments TMS320C6000 Programmer's Manual

Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

Example 8–16. Clear Below Threshold Kernel
void clear_below_thresh(unsigned char *restrict image, int count,
{
int i;
for (i = 0; i < count; i++)
{
if (image[i] <= threshold)
}
}
Example 8–16 illustrates an example that can benefit from the packed
compare and expand intrinsics in action. The Clear Below Threshold kernel
scans an image of 8-bit unsigned pixels, and sets all pixels that are below a
certain threshold to 0.
unsigned char threshold)
image[i] = 0;
Vectorization techniques are applied to the code (as described in Section 8.2),
giving the result shown in Example 8–17. The _cmpgtu4() intrinsic compares
against the threshold values, and the _xpnd4() intrinsic generates a mask for
setting pixels to 0. Note that the new code has the restriction that the input
image must be double-word aligned, and must contain a multiple of 8 pixels.
These restrictions are reasonable as common image sizes have a multiple of
8 pixels.
Packed-Data Processing on the 'C64x
'C64x Programming Considerations
8-43

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C6000 and is the answer not in the manual?

Questions and answers

Table of Contents