This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: C66X_IMG_LIB questions

Part Number: AM5728

Tool/software: Linux

Hi,

We want to acclerate our algorithm on DSP.

1.We tried to use Opencv to acclerate such as erdoe() and dilate() , 

"cv::ocl::setUseOpenCL(true);" , "export OPENCV_OPENCL_DEVICE='TI AM57:ACCELERATOR:TI Multicore C66 DSP'" and the UMat is done.

But there is no different between use opencl to acclerate or not .

2.We tried to create our own opencl kernel which link with C66x_IMG_LIB.

We made it. But We don't know how to use the function in LIB.

Such as erode():

Host side:

kernel.setArg(0, bufA);
kernel.setArg(1, bufDst);
kernel.setArg(2, 256*256);

DSP side:

void IMG_erode_bin (const unsigned char *restrict in_data, unsigned char *restrict out_data, const char *restrict mask, int cols);
kernel void maskVector(global const uchar* src, global uchar* dst,const int cols )
{

const char arry[9]={
1 , 1 , 1 ,
1 , 1 , 1 ,
1 , 1 , 1 
};

IMG_erode_bin((const unsigned char *)src,(unsigned char *)dst,arry,cols);

}

output.zip

We don't know why the output img is all black.

Please help us.

Best regards. 

  • The software team have been notified. They will respond here.
  • Have you tried to test the function in DSP only environment before trying to use it with OpenCL. Is the output from the function correct when only DSP is being used? Most likely reason if the output is zero is that the input from the ARM is not being passed to the DSP correctly. this could be an address translation issue, cache issue ? Is there a way you can halt the DSP by adding a spinlock and see if the right input is received by the DSP.

    Regards,
    Rahul
  • Thanks for your reply
    We are confused about how to use IMG_erode_bin()
    We can see from IMG_erode_bin.c to operate one piexl by one bit.
    Is that mean we should compress a image which is 256x256 bytes to 256x256 bits ?
    Regards
  • Current implementation is described in the IMGLIB USER manual here:
    imglib_c66x_3_1_1_0/docs/doxygen/html/imglib_html/group___i_m_g__erode__bin.html

    The function IMG_erode_bin() implements binary erosion using an arbitrary 3x3 mask. The erosion operator generates output pixels by ANDing the pixels under the input mask together to generate the output pixel. The input mask specifies whether one or more pixels from the input are to be ignored.

    You can also look at the C implementation instead of the intrinsic implementation on how it handles the input data.

    Regards,
    Rahul