Regarding memcpy of decoded yuv

Hello,


It is difficult to specify the memory location when copying the decoded yuv plane.
1: Declare memory to be used as buffer and allocate parm.psize[plane] size
2: Open the file in append mode
3: Try memcpy with reference to the above commented stream->write
4. Write to file with fwrite() function
5. free allocated memory

Is there any part you can give advice on when specifying the memory location and size in steps 1-5?

For parameters, I refer to the structure(NvBufferParams) of the following file.


Thank you.

Hi,
We have checked the custom code but don’t understand it. Actually for saving to a file, you can simply call dump_dmabuf() and don’t need to allocate one more buffer.

1 Like

Hello,

We want to use the decoded yuv buffer directly in another program without writing to the file.

Thank you.

Hello,

We try to play the video in the qt program after converting color space using our own opengl code without using the provided EGL renderer(NvEglRenderer.cpp).

The buffer has the form: The purpose is to receive h264 one by one as a stream, decode yuv one by one through nvdec, and pass it to the following buffer type.


We want to use the decoded yuv buffer directly in another program without writing to the file.

So I just moved the buffer using memcpy and wrote it back to the file to check it.

It’s not the purpose of writing to a file, but to pass the decoded yuv buffer to the OpenGL shader.

Thank you.

Hi,
You would need to allocate the buffer outside dump_dmabuf(). Is the fist call of dump_dmabuf(), copy the Y plane from offset 0 with pixel_w * pixel_h bytes. In the second call, copy the UV plance from offset pixel_w * pixel_h with pixel_w * pixel_h / 2 bytes.