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;
...
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);
...