#include "HxFuncGenConv3dK1d.h"
#include "HxEnvironment.h"
GenConv3dK1d_variations | |
| template<class DstDataPtrType, class SrcDataPtrType, class KernelT, class PixOpT, class RedOpT> void | HxFuncGenConv3dK1d_XdirSim (DstDataPtrType dstPtr, SrcDataPtrType srcPtr, KernelT &kernel, HxSizes dstSize, PixOpT &pixOp, RedOpT &redOp) |
| GenConv3dK1d : X direction, simple. More... | |
| template<class DstDataPtrType, class SrcDataPtrType, class KernelT, class PixOpT, class RedOpT> void | HxFuncGenConv3dK1d_YdirSim (DstDataPtrType dstPtr, SrcDataPtrType srcPtr, KernelT &kernel, HxSizes dstSize, PixOpT &pixOp, RedOpT &redOp) |
| GenConv3dK1d : Y direction, simple. More... | |
| template<class DstDataPtrType, class SrcDataPtrType, class KernelT, class PixOpT, class RedOpT> void | HxFuncGenConv3dK1d_ZdirSim (DstDataPtrType dstPtr, SrcDataPtrType srcPtr, KernelT &kernel, HxSizes dstSize, PixOpT &pixOp, RedOpT &redOp) |
| GenConv3dK1d : Z direction, simple. More... | |
Functions | |
| template<class DstDataPtrType, class SrcDataPtrType, class KernelT, class PixOpT, class RedOpT> void | HxFuncGenConv3dK1dDispatch (DstDataPtrType dstPtr, SrcDataPtrType srcPtr, KernelT &kernel, HxSizes dstSize, PixOpT &pixOp, RedOpT &redOp, int dimension) |
| Dispatch function for GenConv3dK1d (see Global functions for GenConv3dK1d) Dispatch is based on dimension and inplace parameters. More... | |
|
||||||||||||||||||||||||||||||||
|
GenConv3dK1d : X direction, simple.
00049 {
00050 HxSizes kerSize = kernel.sizes();
00051 int imgWidth = dstSize.x();
00052 int imgHeight = dstSize.y();
00053 int imgDepth = dstSize.z();
00054 int kerWidth = kerSize.x();
00055
00056 int x, y, z, i;
00057
00058 typedef typename KernelT::ArithType ArithType;
00059 ArithType result, tmpVal;
00060
00061 for (z=0 ; z<imgDepth ; z++) {
00062 for (y=0 ; y<imgHeight ; y++) {
00063 DstDataPtrType dPtr = dstPtr;
00064 dPtr.incXYZ(0, y, z);
00065 for (x=0 ; x<imgWidth ; x++) {
00066 SrcDataPtrType sPtr = srcPtr;
00067 sPtr.incXYZ(x, y, z);
00068 result = RedOpT::neutralElement();
00069 for (i=0 ; i<kerWidth ; i++) {
00070 tmpVal = pixOp.doIt(sPtr.read(), kernel(i));
00071 redOp.doIt(result, tmpVal);
00072 sPtr.incX();
00073 }
00074 dPtr.write(result);
00075 dPtr.incX();
00076 }
00077 }
00078 }
00079 }
|
|
||||||||||||||||||||||||||||||||
|
GenConv3dK1d : Y direction, simple.
00088 {
00089 HxSizes kerSize = kernel.sizes();
00090 int imgWidth = dstSize.x();
00091 int imgHeight = dstSize.y();
00092 int imgDepth = dstSize.z();
00093 int kerWidth = kerSize.x();
00094
00095 int x, y, z, i;
00096
00097 typedef typename KernelT::ArithType ArithType;
00098 ArithType result, tmpVal;
00099
00100 for (z=0 ; z<imgDepth ; z++) {
00101 for (y=0 ; y<imgHeight ; y++) {
00102 DstDataPtrType dPtr = dstPtr;
00103 dPtr.incXYZ(0, y, z);
00104 for (x=0 ; x<imgWidth ; x++) {
00105 SrcDataPtrType sPtr = srcPtr;
00106 sPtr.incXYZ(x, y, z);
00107 result = RedOpT::neutralElement();
00108 for (i=0 ; i<kerWidth ; i++) {
00109 tmpVal = pixOp.doIt(sPtr.read(), kernel(i));
00110 redOp.doIt(result, tmpVal);
00111 sPtr.incY();
00112 }
00113 dPtr.write(result);
00114 dPtr.incX();
00115 }
00116 }
00117 }
00118 }
|
|
||||||||||||||||||||||||||||||||
|
GenConv3dK1d : Z direction, simple.
00127 {
00128 HxSizes kerSize = kernel.sizes();
00129 int imgWidth = dstSize.x();
00130 int imgHeight = dstSize.y();
00131 int imgDepth = dstSize.z();
00132 int kerWidth = kerSize.x();
00133
00134 int x, y, z, i;
00135
00136 typedef typename KernelT::ArithType ArithType;
00137 ArithType result, tmpVal;
00138
00139 for (z=0 ; z<imgDepth ; z++) {
00140 for (y=0 ; y<imgHeight ; y++) {
00141 DstDataPtrType dPtr = dstPtr;
00142 dPtr.incXYZ(0, y, z);
00143 for (x=0 ; x<imgWidth ; x++) {
00144 SrcDataPtrType sPtr = srcPtr;
00145 sPtr.incXYZ(x, y, z);
00146 result = RedOpT::neutralElement();
00147 for (i=0 ; i<kerWidth ; i++) {
00148 tmpVal = pixOp.doIt(sPtr.read(), kernel(i));
00149 redOp.doIt(result, tmpVal);
00150 sPtr.incZ();
00151 }
00152 dPtr.write(result);
00153 dPtr.incX();
00154 }
00155 }
00156 }
00157 }
|
|
||||||||||||||||||||||||||||||||||||
|
Dispatch function for GenConv3dK1d (see Global functions for GenConv3dK1d) Dispatch is based on dimension and inplace parameters.
00172 {
00173 switch (dimension) {
00174 case 1 :
00175 HxFuncGenConv3dK1d_XdirSim(
00176 dstPtr, srcPtr, kernel, dstSize, pixOp, redOp);
00177 break;
00178 case 2 :
00179 HxFuncGenConv3dK1d_YdirSim(
00180 dstPtr, srcPtr, kernel, dstSize, pixOp, redOp);
00181 break;
00182 case 3 :
00183 HxFuncGenConv3dK1d_ZdirSim(
00184 dstPtr, srcPtr, kernel, dstSize, pixOp, redOp);
00185 break;
00186 default :
00187 HxEnvironment::instance()->errorStream()
00188 << "HxFuncGenConv3dK1dDispatch: "
00189 << "cannot execute convolution in dimension " << dimension
00190 << STD_ENDL;
00191 HxEnvironment::instance()->flush();
00192 }
00193 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001