[iMX8MP] How to debug VPU_EncEncodeFrame() = 2 : INVALID_PARAM

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

[iMX8MP] How to debug VPU_EncEncodeFrame() = 2 : INVALID_PARAM

跳至解决方案
544 次查看
b_m
Contributor III

I am trying to encode via VPU wrapper as written in this manual, however VPU_EncEncodeFrame() is returning 2 : INVALID_PARAM, without any other error logs showing on the console.

1. Can anyone tell me how to debug this to know which parameter is causing this error?
2. Is VPU_EncEncodeFrame() 's parameter the only parameter that is faulty here, so I don't need to check parameters passed to previously called API's such as VPU_EncOpenSimp()?
3. Checking vpu_wrapper.c, I see that some logs are output via VPU_LOG() or VPU_ENC_LOG(), can this be enabled from the application side? And is it correct to assume that if it is enabled, the log is directed to the console?
4. Any sample codes that implements encoding via VPU wrapper, specifically for imx8mp?

Any replies would be highly appreciated!

0 项奖励
回复
1 解答
413 次查看
b_m
Contributor III

Hi joanxie, thanks for the follow-up.

Turned out the problem was the 1st argument VpuEncHandle, created from VPU_EncOpenSimp(), was not passed properly to VPU_EncEncodeFrame().

We got too focused on the term "PARAM" of the error code, thought it pertained to VpuEncOpenParamSimp, and assumed a separate error code (3 : INVALID_HANDLE) would be set with regards to VpuEncHandle.

在原帖中查看解决方案

0 项奖励
回复
4 回复数
512 次查看
joanxie
NXP TechSupport
NXP TechSupport

what's your use case? did you download nxp yocto bsp? what source code do you refer to?

0 项奖励
回复
503 次查看
b_m
Contributor III

Hi, thanks for replying!

>what's your use case?
I am trying to make an application that would run on imx8mp evk, which encodes a single image file (believed to be of YUV420 format) into H264 format. 
Basically, I just want to see first how encoding works as I have no background on this.

This input image file is created via the following command:
gst-launch-1.0 filesrc location="raw.jpg"  ! jpegdec ! filesink location="image_file.yuv"

raw.jpg: JPEG file created on Paint (1920x1080)
image_file.yuv: my application's input file which I believe/hope is of YUV420 format

> did you download nxp yocto bsp? 
Yes, I am using yocto-real-time-edge bsp.

>what source code do you refer to?
None, I am only referring to the VPU reference manual, that's why I included that same question in my original post.

Parameters passed to VPU_EncOpenSimp and VPU_EncEncodeFrame are mostly set to automatic values (0 or -1), according to the manual.

Other parameters are based on the input image file, such as size.

0 项奖励
回复
427 次查看
joanxie
NXP TechSupport
NXP TechSupport

sorry I missed this update somehow, I think you need add some extra plugins to support jpeg to yuv, you can try this command to display jpeg firstly, we tested this before

gst-launch-1.0 -v filesrc location=<output_image>.jpeg ! jpegdec ! imagefreeze ! videoconvert ! autovideosink

0 项奖励
回复
414 次查看
b_m
Contributor III

Hi joanxie, thanks for the follow-up.

Turned out the problem was the 1st argument VpuEncHandle, created from VPU_EncOpenSimp(), was not passed properly to VPU_EncEncodeFrame().

We got too focused on the term "PARAM" of the error code, thought it pertained to VpuEncOpenParamSimp, and assumed a separate error code (3 : INVALID_HANDLE) would be set with regards to VpuEncHandle.

0 项奖励
回复