problem with NPP image resize function --nppiResize_8u_C1R

Can anyone tell me how to use the Resize function in cuda NPP ? I have a source image, I converted it to Y Cb Cr colour space by using the nppiRGBToYCbCr_8u_C3R NPP function which works, then I wrote a kernel to extract the three components and stored them as separate images. Till this everything works correctly. Now I want to resize the 3 channels. But the resize NPP function does not work correctly. Is this the right way to use it ?

    double ratio_aim = 25;
    NppiSize srcSize = {srcWidth, srcHeight};
int srcLineStep = srcWidth;
NppiRect srcROI = {srcWidth, srcHeight};
NppiSize resdstROI = {(int)srcWidth*ratio_aim, (int)srcHeight*ratio_aim};
int yLine,cbLine, crLine; 


Npp8u *y_img = nppiMalloc_8u_C1(resdstROI.width, resdstROI.height, &yLine);
Npp8u *cb_img = nppiMalloc_8u_C1(resdstROI.width, resdstROI.height, &cbLine);
Npp8u *cr_img = nppiMalloc_8u_C1(resdstROI.width, resdstROI.height, &crLine);

nppiResize_8u_C1R(y_channel, srcSize, srcLineStep, srcROI, y_img, yLine, resdstROI, 0.25, 0.25, 4);
nppiResize_8u_C1R(cb_channel, srcSize, srcLineStep, srcROI, cb_img, cbLine, resdstROI, ratio_aim, ratio_aim, 4);
nppiResize_8u_C1R(cr_channel, srcSize, srcLineStep, srcROI, cr_img, crLine, resdstROI, ratio_aim, ratio_aim, 4);

Thanks,

What are the symptoms of it not working correctly? I don’t see any error checking in your code.

Several questions:

[font=“Courier New”]double ratio_aim = 25; //<<< is this supposed to be .25?? you’re using 0.25 further down…

nppiResize_8u_C1R(y_channel, srcSize, srcLineStep, srcROI, y_img, yLine, resdstROI, 0.25, 0.25, 4);
nppiResize_8u_C1R(cb_channel, srcSize, srcLineStep, srcROI, cb_img, cbLine, resdstROI, ratio_aim, ratio_aim, 4);[/font]
Also:

[font=“Courier New”]NppiRect srcROI = {srcWidth, srcHeight}; //<<< This should probably be initialized to {0, 0, srcWidth, srcHeight}[/font]
And last, just for general code readability, I would recommend using [font=“Courier New”]NPPI_INTER_CUBIC [/font]instead of 4.

Sorry, I wasn’t working on this for a while; but I have to get this to work now. Anyway, the error code returned is -6. and the output has all zeros. so that’s how i said it is not working correctly. the value of ratio_aim is 0.25. Could you please tell me what error code of -6 means ? THanks!

The error codes are defined in nppdefs.h.

NPP_SIZE_ERROR = -7