6 changed files with 58 additions and 56 deletions
			
			
		@ -0,0 +1,16 @@ | 
				
			|||||
 | 
					
 | 
				
			||||
 | 
					struct input | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					 int criFilterMode; | 
				
			||||
 | 
					 int frameCntr; | 
				
			||||
 | 
					 int scenariFrameNo; | 
				
			||||
 | 
					}; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					kernel void Cri(read_only image2d_array_t input_frame, read_write image2d_t output_frame, struct input params) | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    const int rows = get_image_height(input_frame); | 
				
			||||
 | 
					    const int cols = get_image_width(input_frame); | 
				
			||||
 | 
					    int4 f = read_imagei(input_frame, (rows,cols,1,1)); | 
				
			||||
 | 
					    printf("out: %a | ", f.x); | 
				
			||||
 | 
					    // printf("   :hi! I am the cri kernel"); | 
				
			||||
 | 
					} | 
				
			||||
@ -1,53 +0,0 @@ | 
				
			|||||
#include "model/processor/strategies/Cri.h" | 
					 | 
				
			||||
#include "model/processor/BIP.h" | 
					 | 
				
			||||
#include <QPixmap> | 
					 | 
				
			||||
#include <QImage> | 
					 | 
				
			||||
 | 
					 | 
				
			||||
Cri::Cri(const Context context,const QString kernelPath,const QObject *parent = Q_NULLPTR) : | 
					 | 
				
			||||
    IProcessStrategy(context, kernelPath, "Cri", parent), | 
					 | 
				
			||||
    _kernelFunctor(KernelFunctor<Image2DArray, Image2D, Cri_t>(_kernel)) | 
					 | 
				
			||||
{ | 
					 | 
				
			||||
    memset(&_kernelParameters, 0, sizeof (Cri_t)); | 
					 | 
				
			||||
//    _criBuffer = new Image2D()[CRI_MAX_BUFFER_SIZE]; | 
					 | 
				
			||||
} | 
					 | 
				
			||||
 | 
					 | 
				
			||||
void Cri::cpuProcess(ScenGenOutput_t params) | 
					 | 
				
			||||
{ | 
					 | 
				
			||||
    if(params.criFilterMode.isUpdated) | 
					 | 
				
			||||
        _kernelParameters.criFilterMode = params.criFilterMode.value; | 
					 | 
				
			||||
    if(params.scenarioFrameNo.isUpdated) | 
					 | 
				
			||||
        _kernelParameters.scenariFrameNo = params.scenarioFrameNo.value; | 
					 | 
				
			||||
    if(params.frameCntr.isUpdated) | 
					 | 
				
			||||
        _kernelParameters.frameCntr = params.frameCntr.value; | 
					 | 
				
			||||
} | 
					 | 
				
			||||
 | 
					 | 
				
			||||
void Cri::finalize() | 
					 | 
				
			||||
{ | 
					 | 
				
			||||
} | 
					 | 
				
			||||
 | 
					 | 
				
			||||
 | 
					 | 
				
			||||
Image* Cri::processKernel(Image *frames, Buffer* scratchPad) | 
					 | 
				
			||||
{ | 
					 | 
				
			||||
    auto format = frames->getImageInfo<CL_IMAGE_FORMAT>(); | 
					 | 
				
			||||
    auto width = frames->getImageInfo<CL_IMAGE_WIDTH>(); | 
					 | 
				
			||||
    auto height = frames->getImageInfo<CL_IMAGE_HEIGHT>(); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    _criBuffer[_kernelParameters.scenariFrameNo] = static_cast<Image2D*>(frames); | 
					 | 
				
			||||
     | 
					 | 
				
			||||
    auto im = Image2DArray(_CLContext, CL_MEM_READ_WRITE,  ImageFormat(format.image_channel_order, format.image_channel_data_type), | 
					 | 
				
			||||
                           16, | 
					 | 
				
			||||
                           1000, | 
					 | 
				
			||||
                           1000, | 
					 | 
				
			||||
                           1000 * sizeof (myflt), | 
					 | 
				
			||||
                           1000 * sizeof (myflt)); | 
					 | 
				
			||||
    cl::enqueueReadImage() | 
					 | 
				
			||||
             | 
					 | 
				
			||||
    auto imageOutput = new Image2D(_CLContext, | 
					 | 
				
			||||
                            CL_MEM_READ_WRITE, | 
					 | 
				
			||||
                            ImageFormat(format.image_channel_order, format.image_channel_data_type), | 
					 | 
				
			||||
                            width, | 
					 | 
				
			||||
                            height); | 
					 | 
				
			||||
 | 
					 | 
				
			||||
    delete frames; | 
					 | 
				
			||||
    return imageOutput; | 
					 | 
				
			||||
} | 
					 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue