Open vpu encoder via vpu_wrapper problems

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Open vpu encoder via vpu_wrapper problems

跳至解决方案
1,466 次查看
matija_bacic
Contributor II

Hello!

2 weeks ago I've started learning embedded systems devlopment. Last summer I did some research on H264 and RTSP/RTP/UDP protocols and now I'm hoping to write a C app for encoding raw YCbCr420 frames to H264 by utilizing the hardware VPU encoder. I feel I am on a right track : so far I have learned Yocto, successfully built an SDK for the imx 8m mini board (full image), successfully compiled a C app against vpu_wrapper.h (libfslvpuwrap) and managed to load/unload the VPU via C code.

Problem arises when the VPU_EncOpenSimp function needs to be called (as per VPU API reference manual Encoding Calling Sequence) with VpuEncOpenParamSimp parameters. As a return code from the function call I always get - VPU_ENC_RET_INVALID_PARAM. I would really appreciate your help. What am I doing wrong? Also, the meaning of a some of the parameters from the VpuEncOpenParamSimp struct is not documented at all.

Thank you in advance,

Matija

Code:

...
VpuEncHandle handle;
...
// Open vpu
enc_open_param_simp = (VpuEncOpenParamSimp*) malloc(sizeof(VpuEncOpenParamSimp));
enc_open_param_simp->eFormat = VPU_V_AVC;
enc_open_param_simp->nPicWidth = 1280;
enc_open_param_simp->nPicHeight = 720;
enc_open_param_simp->nOrigWidth = 1280;
enc_open_param_simp->nOrigHeight = 720
enc_open_param_simp->nRotAngle = 0;
enc_open_param_simp->nFrameRate = 60;
enc_open_param_simp->nBitRate = 2475;
enc_open_param_simp->nGOPSize = 1;
enc_open_param_simp->nIntraRefresh = 0;
enc_open_param_simp->nIntraQP = 0;
enc_open_param_simp->nChromaInterleave = 0;
enc_open_param_simp->sMirror = VPU_ENC_MIRDIR_HOR;
enc_open_param_simp->nMapType = 0;
enc_open_param_simp->nLinear2TiledEnable = 0;
enc_open_param_simp->eColorFormat = VPU_COLOR_420;
enc_open_param_simp->nIsAvcc = 0;
printf("Opening VPU encoder simp... ");
ret_code = VPU_EncOpenSimp(handle, mem_info, enc_open_param_simp);
printf("%d\n",ret_code);
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 项奖励
1 解答
1,401 次查看
matija_bacic
Contributor II

Found a solution to the problem! Turns out api call sequence VPU_EncQueryMem => VPU_EncGetMem does not automatically inform the VPU about the allocated memory. Rather, physical and virtual address members of VpuMemInfo struct need to be configured manualy (that is, copied from VpuMemDesc).

在原帖中查看解决方案

0 项奖励
2 回复数
1,402 次查看
matija_bacic
Contributor II

Found a solution to the problem! Turns out api call sequence VPU_EncQueryMem => VPU_EncGetMem does not automatically inform the VPU about the allocated memory. Rather, physical and virtual address members of VpuMemInfo struct need to be configured manualy (that is, copied from VpuMemDesc).

0 项奖励
798 次查看
a6664120
Contributor I

How did you deal with it,thank you!!

0 项奖励