#include "model/processor/strategies/TintMap.h" #include "model/processor/BIP.h" #include #include TintMap::TintMap(const Context context, const QString kernelPath, const QObject *parent = Q_NULLPTR) : IProcessStrategy(context, kernelPath, "TintMap", parent), _kernelFunctor(KernelFunctor(_kernel)) { memset(&_kernelParameters, 0, sizeof (TintMap_t)); } void TintMap::cpuProcess(ScenGenOutput_t parameters) { if(parameters.tintMapSelector.isUpdated) { _kernelParameters.tintMapSelector = parameters.tintMapSelector.value; } } void TintMap::finalize() { } Image* TintMap::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; }