#include "model/processor/strategies/GrayMap.h" #include "model/processor/BIP.h" #include #include GrayMap::GrayMap(const Context context, const QString kernelPath, const QObject *parent = Q_NULLPTR) : IProcessStrategy(context, kernelPath, "GrayMap", parent), _kernelFunctor(KernelFunctor(_kernel)) { memset(&_kernelParameters, 0, sizeof (GrayMap_t)); } void GrayMap::cpuProcess(ScenGenOutput_t parameters) { if(parameters.grayMapSelector.isUpdated) { _kernelParameters.grayMapSelector = parameters.grayMapSelector.value; } } void GrayMap::finalize() { } Image* GrayMap::processKernel(Image *frames, Buffer* scratchPad) { auto width = frames->getImageInfo(); auto height = frames->getImageInfo(); ImageFormat format; format.image_channel_order = CL_RGBA; format.image_channel_data_type = CL_UNSIGNED_INT8; auto imageOutput = new Image2D(_CLContext, CL_MEM_READ_WRITE, format, width, height); //width should be lass than CL_DEVICE_MAX_WORK_GROUP_SIZE(1024 for current machine) or this will break cl::EnqueueArgs eargs(BIP::getInstance()->CLQueue, cl::NDRange(width, height)); _openCLHelper.runKernelFunctor(_kernelFunctor, eargs, *static_cast(frames), *imageOutput, _kernelParameters); delete frames; return imageOutput; }