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.

c6accel yuyv to rgb565 help

hi,all

I met some problem when i use the functions of c6accel to convert yuvu to rgb565.

The code is as follow:

void c6accel_IMG_YUYV_to_RGB(C6accel_Handle hC6accel,unsigned char *yuyv,unsigned char *rgb,int captureWidth,int captureHeight,int displayWidth,int displayHeight)
{   unsigned int h,w;
    unsigned char *pY, *pCb, *pCr;
    struct timeval before, after, result;

    /* Create a CMem heap array that can be translated for DSP */
    short *pYUV2RGB_Cmem;
    pYUV2RGB_Cmem = Memory_alloc(5*sizeof(short),&testfxnsMemParams);

    memset (pOutBuf_16bpp,0x00,captureWidth*captureHeight*2*sizeof(char));
    memset (pSrcBuf_16bpp,0x00,captureWidth*captureHeight*2*sizeof(char));
    memcpy (pSrcBuf_16bpp,yuyv,captureWidth*captureHeight*2*sizeof(char));

    pY = pOutBuf_16bpp;
    //pY = pSrcBuf_16bpp;
    pCb = pY + captureWidth*captureHeight;
    pCr = pCb + (captureWidth*captureHeight)/2;


    /* Call the yc_demux_be8 to generate 422*/
    C6accel_IMG_yc_demux_le8_8(hC6accel,captureWidth*captureHeight,(unsigned char*)pSrcBuf_16bpp,pY, pCr, pCb);
    memset (pRefBuf_16bpp,0x00,captureWidth*captureHeight*2*sizeof(char));
    /* Call the _ycbcr422pl_to_rgb565 as we have 422P data in memory */
    gettimeofday(&before, NULL);
    C6accel_IMG_ycbcr422pl_to_rgb565(hC6accel,pYUV2RGB_Cmem,pY, pCb, pCr,(unsigned short*)pRefBuf_16bpp,captureWidth*captureHeight);
    gettimeofday(&after, NULL);

/*after calling C6accel_IMG_yc_demux_le8_8 & C6accel_IMG_ycbcr422pl_to_rgb565, what i see on the display device is all black*/
/*if i don't call the function C6accel_IMG_yc_demux_le8_8 and set the pY = pSrcBuf_16bpp; then call the function C6accel_IMG_ycbcr422pl_to_rgb565,i can see double image on the display device */

    timeval_subtract(&result, &after, &before);
    printf("C6accel_IMG_ycbcr422pl_to_rgb565() Result Time:\t%ld %ld\n",result.tv_sec, result.tv_usec);

/*the time C6accel_IMG_ycbcr422pl_to_rgb565 cost each time is 0.06s,is this too long?*/


    if (C6Accel_readCallType(hC6accel) == ASYNC){
       // Now wait for the callback
         //LOG_STRING(" ,C6accel_IMG_ycbcr422pl_to_rgb565() wait for callback,");
         //START_BENCHMARK();
         C6accel_waitAsyncCall(hC6accel);
         //END_AND_WRITE_BENCHMARK();
    }

    unsigned char *temp=(unsigned char*)pRefBuf_16bpp;
    for(h=0;h<displayHeight;h++)
    {
    for(w=0;w<captureWidth*2;w++)
    rgb[w]=temp[w];
       rgb +=displayWidth*2;
       //pOutBuf_16bpp +=captureWidth*2*sizeof(char);
    temp +=captureWidth*2;
    }

    /* Free YUV2RGB CMEM array*/
    Memory_free(pYUV2RGB_Cmem,sizeof(short)*5,&testfxnsMemParams);

}

the problems i described above and marked red, i am new ,please help me,thanks~~