Advertisement
onilink_

Untitled

Jun 28th, 2022
857
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None
  1.     kernel_size = kernel_y.size();
  2.     ks_2 = kernel_size / 2;
  3.    
  4.     for(unsigned j=ks_2; j+ks_2<_size.hei; ++j)
  5.     {
  6.         for(unsigned i=0; i<_size.wid; ++i)
  7.         {
  8.             float v = 0;
  9.             for(unsigned y=0; y<kernel_size; ++y)
  10.             {
  11.                 int py = y + j - kernel_size/2;
  12.                 const unsigned index = i + py*_size.wid;
  13.                 assert(index < s);
  14.                 v += t[index] * kernel_y[y];
  15.             }
  16.            
  17.             const unsigned index = i + j*_size.wid;
  18.             assert(index < s);
  19.             out[index] = v;
  20.         }
  21.     }
Advertisement
RAW Paste Data Copied
Advertisement