bool VectorProgram::IsImageFlush(const ImageBase& Source) { if (Source.Width() * Source.NbChannels() * Source.DepthBytes() != Source.Step()) return false; // Image has padding if ((Source.Width() * Source.NbChannels()) % GetVectorWidth(Source.DataType()) != 0) return false; // width is not a multiple of VectorWidth return true; }
cl::NDRange VectorProgram::GetRange(EProgramVersions Version, const ImageBase& Img1) { switch (Version) { case Fast: // The fast version uses a 1D range return cl::NDRange(Img1.Width() * Img1.Height() * Img1.NbChannels() / GetVectorWidth(Img1.DataType()), 1, 1); case Standard: case Unaligned: // The other versions use a 2D range return Img1.VectorRange(GetVectorWidth(Img1.DataType())); case NbVersions: default: throw cl::Error(CL_INVALID_PROGRAM, "Invalid program version in VectorProgram"); } }
bool VectorProgram::IsImageAligned(const ImageBase& Source) { uint BytesPerWorker = Source.DepthBytes() * Source.NbChannels() * GetVectorWidth(Source.DataType()); return (Source.Step() % BytesPerWorker == 0); }