*alpha=getPixelAlpha(p,number_channels);
}
+ inline float4 ReadAllChannels(const __global CLQuantum *image, const unsigned int number_channels,
+ const unsigned int columns, const unsigned int x, const unsigned int y)
+ {
+ const __global CLQuantum *p = image + getPixelIndex(number_channels, columns, x, y);
+
+ float4 pixel;
+
+ pixel.x=getPixelRed(p);
+
+ if (number_channels > 2)
+ {
+ pixel.y=getPixelGreen(p);
+ pixel.z=getPixelBlue(p);
+ }
+
+ if ((number_channels == 4) || (number_channels == 2))
+ pixel.w=getPixelAlpha(p,number_channels);
+ return(pixel);
+ }
+
inline float4 ReadFloat4(const __global CLQuantum *image, const unsigned int number_channels,
const unsigned int columns, const unsigned int x, const unsigned int y, const ChannelType channel)
{
setPixelAlpha(p,number_channels,ClampToQuantum(alpha));
}
+ inline void WriteAllChannels(__global CLQuantum *image, const unsigned int number_channels,
+ const unsigned int columns, const unsigned int x, const unsigned int y, float4 pixel)
+ {
+ __global CLQuantum *p = image + getPixelIndex(number_channels, columns, x, y);
+
+ setPixelRed(p,ClampToQuantum(pixel.x));
+
+ if (number_channels > 2)
+ {
+ setPixelGreen(p,ClampToQuantum(pixel.y));
+ setPixelBlue(p,ClampToQuantum(pixel.z));
+ }
+
+ if ((number_channels == 4) || (number_channels == 2))
+ setPixelAlpha(p,number_channels,ClampToQuantum(pixel.w));
+ }
+
inline void WriteFloat4(__global CLQuantum *image, const unsigned int number_channels,
const unsigned int columns, const unsigned int x, const unsigned int y, const ChannelType channel,
float4 pixel)
filteredPixel.z *= gamma;
}
- WriteFloat4(filteredImage, number_channels, filteredColumns, chunkStartX + itemID, y, AllChannels, filteredPixel);
+ WriteAllChannels(filteredImage, number_channels, filteredColumns, chunkStartX + itemID, y, filteredPixel);
}
}
}
filteredPixel.z *= gamma;
}
- WriteFloat4(filteredImage, number_channels, filteredColumns, x, chunkStartY + itemID, AllChannels, filteredPixel);
+ WriteAllChannels(filteredImage, number_channels, filteredColumns, x, chunkStartY + itemID, filteredPixel);
}
}
}
int cx = ClampToCanvas(blurCenter.x+center_x*cos_theta[i]-center_y*sin_theta[i]+0.5f,columns);
int cy = ClampToCanvas(blurCenter.y+center_x*sin_theta[i]+center_y*cos_theta[i]+0.5f,rows);
- float4 pixel = ReadFloat4(image, number_channels, columns, cx, cy, AllChannels);
+ float4 pixel = ReadAllChannels(image, number_channels, columns, cx, cy);
if ((number_channels == 4) || (number_channels == 2))
{