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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

Jump to solution
242 Views
b_m
Contributor II

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 Kudos
Reply
1 Solution
111 Views
b_m
Contributor II

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.

View solution in original post

0 Kudos
Reply
4 Replies
210 Views
joanxie
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply
201 Views
b_m
Contributor II

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 Kudos
Reply
125 Views
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 Kudos
Reply
112 Views
b_m
Contributor II

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 Kudos
Reply