Bookmark and Share

ARM Guide to OpenCL Optimizing Pyramid: Initial Implementation

Register or sign in to access the Embedded Vision Academy's free technical training content.

The training materials provided by the Embedded Vision Academy are offered free of charge to everyone. All we ask in return is that you register, and tell us a little about yourself so that we can understand a bit about our audience. As detailed in our Privacy Policy, we will not share your registration information, nor contact you, except with your consent.

Registration is free and takes less than one minute. Click here to register, and get full access to the Embedded Vision Academy's unique technical training content.

If you've already registered, click here to sign in.

See a sample of this page's content below:


This chapter describes an initial, unoptimized implementation of pyramid.

Initial code

The initial, unoptimized code uses the basic pyramid process where an unaltered Gaussian convolution is applied, then the result is subsampled. This process is then repeated on the result to create the pyramid image for further levels.

The initial Gaussian 5x5 filter implementation

The code for the initial unoptimized Gaussian pyramid uses the same convolution code as the ARM® Guide to OpenCL Optimizing Convolution example.

The following code shows the Gaussian 5x5 filter code from the ARM® Guide to OpenCL Optimizing Convolution.

// Variables declaration

...

#define PARTIAL_CONVOLUTION( i, m0, m1, m2, m3, m4 )\
     do{\
          temp = vload16(0, src + addr + i * strideByte);\
          temp2 = vload4(0, src + addr + i * strideByte + 16);\
          l2Row = temp.s01234567;\
          l1Row = temp.s3456789A;\
          mRow = temp.s6789ABCD;\
          r1Row = (uchar8)(temp.s9ABC, temp.sDEF, temp2.s0);\
          r2Row = (uchar8)(temp.sCDEF, temp2.s0123);\
          l2Data = convert_ushort8(l2Row);\
          l1Data = convert_ushort8(l1Row);\
          mData = convert_ushort8(mRow);\
          r1Data = convert_ushort8(r1Row);\
          r2Data = convert_ushort8(r2Row);\
          pixels += l2Data * (ushort8)m0;\
          pixels += l1Data * (ushort8)m1;\
          pixels += mData * (ushort8)m2;\
          pixels += r1Data * (ushort8)m3;\
          pixels += r2Data * (ushort8)m4;\
     }while(0)

     PARTIAL_CONVOLUTION( -2, MAT0, MAT1, MAT2, MAT3, MAT4);
     PARTIAL_CONVOLUTION( -1, MAT5, MAT6, MAT7, MAT8, MAT9);
     PARTIAL_CONVOLUTION( 0, MAT10, MAT11,...