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.

DM6437 - Not be able to trigger Preview Engine in VPFE driver

Hi,

I have a problem to trigger the preview engine after I open the channel, set the configuration of preview engine.  I had a bayer image in DDR2 memory and try to use the preview engine to convert it into YCC422 image and store it back to DDR2.   The code to trigger the preview is prevPreviewIOMReturnCode = GIO_control(prevHandle, PSP_PREVIEWER_IOCTL_PREVIEW, &prevPreviewParams);  and the prevPreviewIOMReturnCode is "-7" which is IOM_EBADMODE, "illegal device mode".  Can anyone help me to let me know which part might be wrong?  Thank you.

The prePreviewParams is setup as

  prevPreviewParams.inBuf = pBayerImgOut;  // Bayer image
  prevPreviewParams.outBuf = dstptrFB;         //  YCC image
  prevPreviewParams.inBufSize = (INPUT_IMAGE_HEIGHT * INPUT_IMAGE_WIDTH);  //480 * 720
  prevPreviewParams.outBufSize = (INPUT_IMAGE_HEIGHT * INPUT_IMAGE_WIDTH * 2);    //480*720*2

The following code is used to open the preview engine channel,

    prevOpenPrevChannel.chanSource.source = PSP_PREVIEWER_CHANNEL_SDRAM;
    prevOpenPrevChannel.segId = 0;
    prevHandle = GIO_create(prevDeviceName, IOM_INOUT, NULL, &prevOpenPrevChannel, NULL);

I use the following the structure prevParams to configure the preview engine

    prevParams.downSampleRate =  PSP_PREVIEWER_DOWN_SAMPLE_RATE1;
    prevParams.sizeParam.sph   = 0;
    prevParams.sizeParam.eph   = INPUT_IMAGE_WIDTH - 1;
    prevParams.sizeParam.slv   = 0;
    prevParams.sizeParam.elv   = INPUT_IMAGE_HEIGHT - 1;
    prevParams.sizeParam.pixelSize = PSP_PREVIEWER_INWIDTH_8BIT;
    prevParams.sizeParam.inPitch = (INPUT_IMAGE_WIDTH * 2u);
    prevParams.sizeParam.outPitch = (INPUT_IMAGE_WIDTH * 2u);

    prevParams.whiteBalanceParam.wbDgain   = 0x100;
    prevParams.whiteBalanceParam.wbGain[0] = 0x40;
    prevParams.whiteBalanceParam.wbGain[1] = 0x40;
    prevParams.whiteBalanceParam.wbGain[2] = 0x40;
    prevParams.whiteBalanceParam.wbGain[3] = 0x40;

    prevParams.whiteBalanceParam.position[0][0] = 0;
    prevParams.whiteBalanceParam.position[0][1] = 1;
    prevParams.whiteBalanceParam.position[0][2] = 0;
    prevParams.whiteBalanceParam.position[0][3] = 1;

    prevParams.whiteBalanceParam.position[1][0] = 2;
    prevParams.whiteBalanceParam.position[1][1] = 3;
    prevParams.whiteBalanceParam.position[1][2] = 2;
    prevParams.whiteBalanceParam.position[1][3] = 3;

    prevParams.whiteBalanceParam.position[2][0] = 0;
    prevParams.whiteBalanceParam.position[2][1] = 1;
    prevParams.whiteBalanceParam.position[2][2] = 0;
    prevParams.whiteBalanceParam.position[2][3] = 1;

    prevParams.whiteBalanceParam.position[3][0] = 2;
    prevParams.whiteBalanceParam.position[3][1] = 3;
    prevParams.whiteBalanceParam.position[3][2] = 2;
    prevParams.whiteBalanceParam.position[3][3] = 3;

    prevParams.rgbBlendingParam.blending[0][0] = 0x1a1;
    prevParams.rgbBlendingParam.blending[0][1] = 0xf8a;
    prevParams.rgbBlendingParam.blending[0][2] = 0xfd5;
    prevParams.rgbBlendingParam.blending[1][0] = 0xfa1;
    prevParams.rgbBlendingParam.blending[1][1] = 0x1c4;
    prevParams.rgbBlendingParam.blending[1][2] = 0xf9b;
    prevParams.rgbBlendingParam.blending[2][0] = 0xfbd;
    prevParams.rgbBlendingParam.blending[2][1] = 0xfb1;
    prevParams.rgbBlendingParam.blending[2][2] = 0x192;

    prevParams.rgbBlendingParam.offset[0] = 0;
    prevParams.rgbBlendingParam.offset[1] = 0;
    prevParams.rgbBlendingParam.offset[2] = 0;

    prevParams.rgb2ycbcrParam.coeff[0][0] = 0x4D;
    prevParams.rgb2ycbcrParam.coeff[0][1] = 0x96;
    prevParams.rgb2ycbcrParam.coeff[0][2] = 0x1D;
    prevParams.rgb2ycbcrParam.coeff[1][0] = 0x3d4;
    prevParams.rgb2ycbcrParam.coeff[1][1] = 0x3ac;
    prevParams.rgb2ycbcrParam.coeff[1][2] = 0x82;
    prevParams.rgb2ycbcrParam.coeff[2][0] = 0x82;
    prevParams.rgb2ycbcrParam.coeff[2][1] = 0x395;
    prevParams.rgb2ycbcrParam.coeff[2][2] = 0x3eb;

    prevParams.rgb2ycbcrParam.yOffset     = 0;
    prevParams.rgb2ycbcrParam.cbOffset    = 0;
    prevParams.rgb2ycbcrParam.crOffset    = 0;

    prevParams.blackAdjParam.blueAdj      = 0;
    prevParams.blackAdjParam.redAdj       = 0;
    prevParams.blackAdjParam.greenAdj     = 0;

    prevParams.brightness = 0x20u;
    prevParams.contrast   = 0x10u;

    prevParams.features       =  PSP_PREVIEWER_CFA;
    for (i=0; i< PSP_PREVIEWER_CFA_COEFF_TABLE_SIZE; i++)
    {
        prevParams.cfaCoeffsParam.coeffs[i] = cfa_coef[i];
    }
    prevParams.cfaCoeffsParam.vThreshold = 0x28;
    prevParams.cfaCoeffsParam.hThreshold = 0x28;

    prevParams.outPixelOrderParam = PSP_PREVIEWER_PIXELORDER_YCRYCB;

 

  • Hi.
    Late answer, but maybe will help those who have not yet decided the issue.
    You must install multiple frame sizes 32, 720 instead of 736 or 640 for example.

  • I see that you have done something that I can not now.
    I'm trying to take c MT9V032 raw 8-bit data, I manage it, but it seems that does not work preview engine. Tried source CCDC and SDRAM, but all in vain.

    Here is the RAW image data (correctly):

    Here YUV (not correct)

    Thanks & Regards.