VDEC Q&A
Q1:How to find the cause of blurry screen?
-
First dump the es stream before the vdec pre-module, and use the video analysis software to check whether the es stream file has errors.
Find function MI_VDEC_SendStream in the code, write the data to the file through fwrite before calling this function, and save it as an es file. as follows:
MI_VDEC_VideoStream_t stVdecStream; MI_S32 s32Ret; memset(&stVdecStream, 0, sizeof(MI_VDEC_VideoStream_t)); stVdecStream.pu8Addr = data; stVdecStream.u32Len = size; stVdecStream.u64PTS = pts; stVdecStream.bEndOfFrame = 1; stVdecStream.bEndOfStream = 0; FILE *h264_fd = fopen("/mnt/h264_dump.es", "w+"); fwrite(stVdecStream.pu8Addr, stVdecStream.u32Len, 1, h264_fd); fclose(h264_fd); s32Ret = MI_VDEC_SendStream(VDEC_CHN_ID, &stVdecStream, 30);
-
Use the following commands dump vdec output yuv image or disp input image:
dump frame buf: echo dumpfb [chn] [path] [frmcnt] [bDumpAll] [bDetile] > /proc/mi_modules/mi_vdec/mi_vdec0 echo dumpfb 0 /mnt 3 0 0 > /proc/mi_modules/mi_vdec/mi_vdec0 //dump 3 frames Dumpframe: echo dumpframe [layerid] [portid] [path] > /proc/mi_modules/mi_disp/mi_disp0 echo dumpframe 0 0 /mnt/ > /proc/mi_modules/mi_disp/mi_disp0
Use yuv check if the image is blurry.
Q2: How to deal with yuv images in tile mode format?
When vdec outputs yuv images in tile mode format, the vdec output buffer is 128-aligned in width and 32-aligned in height. The size of the buffer after detile processing is greater than the size of the actual image.
When using the MI_SYS_ChnInputPortGetBuf interface to copy the detile buffer to other modules (such as venc), you also need to set 128x32 alignment and crop.
MI_SYS_BufConf_t stBufConf; MI_SYS_BufInfo_t stBufInfoVenc; stBufConf.stFrameCfg.stFrameBufExtraConf.u16BufHAlignment = 128; stBufConf.stFrameCfg.stFrameBufExtraConf.u16BufVAlignment = 32; stBufInfoVenc.stFrameData.stContentCropWindow.u16X = 0; stBufInfoVenc.stFrameData.stContentCropWindow.u16Y = 0; stBufInfoVenc.stFrameData.stContentCropWindow.u16Width = VIDEO_VDEC_INPUT_WIDTH; stBufInfoVenc.stFrameData.stContentCropWindow.u16Height = VIDEO_VDEC_INPUT_HEIGHT;
...