VPU ERR "b or size is zero"

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VPU ERR "b or size is zero"

Jump to solution
662 Views
tedxi
Contributor I

   我根据mxc_vpu_test和imx vpu文档为imx6写了一个c++ mjpeg解码类,用来给我的mjpeg摄像头解码。我调用vpu_DecGetInitialInfo()函数获取图像的数据时在函数内部报了如下错误[ERR] b or size is zero。请问有没有人知道这意味着什么。

   我的使用VPU操作如下:

   1.调用vpu_Init(NULL);

   2.设置DecOpenParam

    openparam.bitstreamFormat = STD_MJPG;
    openparam.bitstreamBufferSize = buffer_size;
    openparam.bitstreamBuffer = init_mem.phy_addr;
    openparam.mp4DeblkEnable = 0;//for MPEG4 and H.263
    openparam.reorderEnable = 1;//for H.264
    openparam.chromaInterleave = 1;//0 = CbCr not interleaved, 1 = CbCr interleaved
    openparam.mapType = 0;//0 is a linear frame map. 1 is a frame tiled map. 2 is a filed tiled map
    openparam.tiled2LinearEnable = 0;
    openparam.mp4Class = 0;//MPEG4 type 0 = MPEG-4; 1 = DivX 5.0 or higher; 2 = Xvid; 5 = DivX 4.0
    openparam.jpgLineBufferMode = 0;//0 is a LineBuffer mode and 1 is a streaming mode
    openparam.bitstreamMode = 1;//0 interrupt mode, 1 rollback mode

3.调用vpu_DecOpen(&dechandle,&openparam);

4.调用vpu_DecGetBitstreamBuffer();,计算target_addr

5.memcpy((void *)target_addr,(void *)in_data.buff,in_data.length);并且vpu_DecUpdateBitstreamBuffer(dechandle,in_data.length);

6.vpu_DecGiveCommand(dechandle,DEC_SET_REPORT_USERDATA, &userData);//我看见实例里面无论userData.enable是否为1都会执行,我索性就也写了这一句,虽然我不知道这有什么用,但是不论我是否执行都报相同的错误

7.调用

    vpu_DecSetEscSeqInit(dechandle, 1);
    ret = vpu_DecGetInitialInfo(dechandle, &initinfo);
    vpu_DecSetEscSeqInit(dechandle, 0);

在vpu_DecGetInitialInfo()函数中报了[ERR] b or size is zero错误。

返回值为RETCODE_SUCCESS。

   在后面从结构体中获得的图像长宽,图像格式等参数都为0,但streamInfoObtained为1。

我输出的调试信息如下图:2018-02-26 18-14-40 的屏幕截图.png

我确定我摄像头捕获的图像没有问题

   我摄像头分辨率设置为1280*720。我使用tcp将摄像头得到的图像传到电脑上可以解码并且正确现实。

                                                                                                                                                                        谢谢

0 Kudos
1 Solution
495 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the vpu reference manual:

Open a decoder instance using vpu_DecOpen(). Call IOGetPhyMem() before opening the instance to input
oparam.bitstreamBuffer. Call IOGetVirtMem() to get the corresponding virtual address of the bitstream buffer, then
fill the bitstream at this address in user space. Call IOGetPhyMem() for both the physical PS save buffer and physical
slice save memory for H.264.

pls check if you set the correct stream buffer

View solution in original post

1 Reply
496 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the vpu reference manual:

Open a decoder instance using vpu_DecOpen(). Call IOGetPhyMem() before opening the instance to input
oparam.bitstreamBuffer. Call IOGetVirtMem() to get the corresponding virtual address of the bitstream buffer, then
fill the bitstream at this address in user space. Call IOGetPhyMem() for both the physical PS save buffer and physical
slice save memory for H.264.

pls check if you set the correct stream buffer