![]() ![]() The main steps for the host code are similar to those in Figure 4.2. ![]() In this case, because we rotating about the originĭest_data = src_data Īs seen in the previous kernel code, image rotation is an embarrassingly parallel problem, in which each resulting pixel value is computed independently. Read (ix,iy) src_data and store at (xpos,ypos) in Int ypos = (int)(yOff*cosTheta − xOff*sinTheta + y0) Int xpos = (int)(xOff*cosTheta + yOff*sinTheta + x0) Calculate location of data to move into (ix,iy) Work-item gets its index within index space ![]() _global float* dest_data, _global float* src_data,įloat sinTheta, float cosTheta) //Rotation Parameters For this reason, we need to check the bounds of the calculated output coordinates. ![]() When an image is rotated, the new locations of some pixels may be outside the image if the input and output image sizes are the same (see Figure 4.3, in which the corners of the input would not have fit within the resultant image). The image rotation example is a good example of an input decomposition, meaning that an element of the input (in this case, an input image) is decomposed into a work-item. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |