-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenCL Programming by Example
By :
Histogram is a graphical representation of tonal distribution of a digital image. It plots the number of pixels for each tonal value. In this example we find the histogram of each of the RGB color components in the color image.
In this section, we will discuss the histogram sample. The sample code has two parts the host code and the device code which is defined as a const char *histogram_kernel. For understanding purpose, we will discuss the OpenCL kernel code that follows. For an OpenCL application programmer most of the effort goes in writing the OpenCL kernel. The majority of the host code is that of setting up the OpenCL platform to run that kernel. We now start with the discussion of the kernel code.
The input image of size X height and Y width is divided into the small linear chunks of size BIN_SIZE=256. Each thread shall process 256 pixel values and compute the RGB histogram. Also the total number of threads in a work group which we have selected is 16...
Change the font size
Change margin width
Change background colour