Open vpu encoder via vpu_wrapper problems

cancel
Showing results for 
Search instead for 
Did you mean: 

Open vpu encoder via vpu_wrapper problems

Jump to solution
840 Views
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 Kudos
1 Solution
775 Views
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).

View solution in original post

0 Kudos
2 Replies
776 Views
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 Kudos
172 Views
a6664120
Contributor I

How did you deal with it,thank you!!

0 Kudos