Closed hughperkins closed 9 years ago
Changed my mind about doing this. I think some of the macros are actually quite more readable than removing them, eg propagate4.cl:
#if gPadZeros == 1
#define inputRow ( outputRow + u )
#else
#define inputRow ( outputRow + u + gHalfFilterSize )
#endif
int inputimagerowoffset = inputRow * gInputImageSize;
int filterrowoffset = (u+gHalfFilterSize) * gFilterSize + gHalfFilterSize;
bool rowOk = inputRow >= 0 && inputRow < gInputImageSize;
for( int v = -gHalfFilterSize; v <= gHalfFilterSize - gEven; v++ ) {
#if gPadZeros == 1
#define inputCol ( outputCol + v )
#else
#define inputCol ( outputCol + v + gHalfFilterSize )
#endif
bool process = rowOk && inputCol >= 0 && inputCol < gInputImageSize;
if( process ) {
sum += _upstreamImage[ inputimagerowoffset + inputCol] * _filterCube[ filterrowoffset + v ];
Whoever does this would ideally need to benchmark before and after, on a fairly standard gpu, to check that the change doesnt in fact cause a speed reduction.