I use vpu to decode jpeg, some code as below, after vpu_DecGetOutputInfo call successfully, I always can't get any decoded YUV data from frame buffer indicated by outInfo.indexFrameDisplay. platform is i.mx53 and linux. data of frame buffer are always 0s. indexFrameDisplay and indexFrameDecoded always 0.
// get output after decode code snippet
retVal = vpu_DecGetOutputInfo(pObj->handle, &outInfo);
if(retVal != RETCODE_SUCCESS)
{
printf("vpu_DecGetOutputInfo failed: %d\n", retVal);
exit(1);
}
if(outInfo.indexFrameDisplay != -1 && outInfo.indexFrameDisplay != -2 && outInfo.indexFrameDisplay != -3 && outInfo.prescanResult > 0 && outInfo.indexFrameDisplay >= 0)
{
picture = (AVFrame *)data;
startFrameAddr = pObj->frame_buffer_desc[outInfo.indexFrameDisplay].virt_uaddr;
picture->data[0] = (char *)startFrameAddr;
picture->data[1] = (char *)(startFrameAddr + pObj->width * pObj->height);
picture->data[2] =(char *)(picture->data[1] + pObj->width/2 * pObj->height/2);
picture->linesize[0] = pObj->width;
picture->linesize[1] = pObj->width / 2;
picture->linesize[2] = pObj->width / 2;
picture->height = pObj->height;
picture->width = pObj->width;
}
// open decoder code snippets
memset(&openParam, 0, sizeof(DecOpenParam));
openParam.bitstreamBuffer = pObj->bitstream_mem_desc.phy_addr;
openParam.bitstreamBufferSize = pObj->bitstream_mem_desc.size;
openParam.bitstreamFormat = STD_MJPG;
openParam.filePlayEnable = 0;
openParam.dynamicAllocEnable = 0;
if(vpu_DecOpen(&pObj->handle, &openParam) != RETCODE_SUCCESS)
{
printf("decoder open failure \n");
exit(1);
}
已解决! 转到解答。
I had similar issues while working on I.MX.6 - Be sure to enable the ROTATOR feature when decoding JPEG if not doing it already. Refer to the freescale example decoder (dec.c) to see how it is done.
I had similar issues while working on I.MX.6 - Be sure to enable the ROTATOR feature when decoding JPEG if not doing it already. Refer to the freescale example decoder (dec.c) to see how it is done.
May I know where I could get the freescale example decoder ?
Search on freescale website did not help,
I am working on iMX53 , trying to use the VPU for jpeg decoding for a sample gallery application.