v4l2jpegdec C example

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

v4l2jpegdec C example

1,760 Views
jonners_guttman
Contributor II

Hi,

Can anyone provide a C example of how to use the v4l2jpegdec element in gstreamer.

The jpeg image should be an "appsrc" - I have the jpeg image in memory and need to pass this into the v4l2jpegdec decoder.

The decoded image should be sent to an "appsink" element so I get the decoded image in memory.

Many thanks for any help,

Jonners.

Tags (1)
0 Kudos
5 Replies

1,539 Views
joanxie
NXP TechSupport
NXP TechSupport

v4l2jpegdec should be used in the imx8QM  which is under preproduction, so I couldn't checked for you, if you have already have this, I suggest that you use "gst-inspect-1.0 v4l2jpegdec " to check the source code path, then you can find the source code, I think it should be included in the gst plugins

0 Kudos

1,539 Views
jonners_guttman
Contributor II

Hi Joan,

Many thanks for your response.

v4l2jpegdec is on my system ☺

What I am trying to achieve is to have a jpeg image in a buffer in my application (appsrc) and use the hardware decoder on the iMX8X to decode the jpeg into RGB raw data returned in a buffer to my application (appsink.)

I have this working using the “jpegdec” element – however, this is a software decoder and very slow (5 frames per second for a 1080p JPEG). If I replace the “jpegdec” element with “v4l2jpegdec” then I get the following error:

Elements created.

firmware version is 1.3.1

Error received from element mySrc: Internal data stream error.[VPU Decoder] error: don't find buffer when wait_rst_done is true, ctx->firmware_stopped=0fin=0

Debugging information: ../../../../git/libs/gst/base/gstbasesrc[VPU Decoder] error: don't find buffer when wait_rst_done is true, ctx->firmware_stopped=0fin=0

.c(3055): gst_base_src_loop (): /GstPipeline:myPipeline/GstAppSrc[VPU Decoder] error: don't find buffer when wait_rst_done is true, ctx->firmware_stopped=0fin=0

:mySrc:

streaming stopped, reason not-negotiated (-4)

I think this is positive as the VPU decoder has been initialise. I think my problem is that the jpeg image is not in the correct memory for the hardware decoder.

Is this something you might be able to help with?

Attached is a copy of my test application.

Kind regards,

Jonners.

0 Kudos

1,539 Views
joanxie
NXP TechSupport
NXP TechSupport

did you use imx8x or imx8qm board? if imx8x, pls tell me your test steps and gstreamer commands, let me test on my imx8x board

0 Kudos

1,539 Views
jonners_guttman
Contributor II

Hi Joan,

I did this in an iMX8X board. I have attached my test application source code.

Kind regards,

Jonners.

0 Kudos

1,539 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the release note of 4.14.98:

i.MX 8QuadMax and 8QuadXPlus Decoder: HEVC, H.264, MPEG4, MPEG2

it seems that imx8qxp doesn't support jpeg decoder on VPU(hardware)

0 Kudos