November 27, 2022, 11:29am
We are trying to use EGLStream to get image from libargus on the consumer side and feed the data to jpeg encoder.
I want to use CUeglFrame and convert it to NvBuffer (or any other and without copy), so that can use encodeFromFd or encodeFromBuffer method of JPEGEncoder to encode the data.
The samples in libargus and the 05_jpeg_encode doesn’t quite guide on how to achieve this.
November 28, 2022, 2:16am
Please refer to this methos and give it a try:
Argus ==> CUDA ==> JPEG - #3 by DaneLLL
November 28, 2022, 3:16am
The example explains converting from EGLStream::Frame to fd (& other formats). I am looking for CUeglFrame that is received on the consumer which uses cuGraphicsResources. (via cudaEglStreamConsumerConnect() & cudaEglStreamConsumerAcquireFrame())
I am little confused on this. Are EGLStream::Frame & CUeglFrame same?
November 28, 2022, 7:15am
There is no method to map CUeglFrame to NvBuffer. Please have the frame data in NvBuffer and call the functions to map NvBuffer to CUeglFrame.
November 28, 2022, 7:26am
This is the code I am using. How do I have the frame data in NvBuffer here? If there anything needs to be on the producer (argus when creating the stream) side for this?
// Acquire the new Bayer frame from the Argus EGLStream and get the CUDA resource.
CUgraphicsResource bayerResource = 0;
CUresult cuResult = cuEGLStreamConsumerAcquireFrame(
&inputStreamConnection, &bayerResource, NULL, -1);
if (cuResult != CUDA_SUCCESS)
std::cout << "frame acquisition error" << std::endl;
// Get the Bayer EGL frame information from the CUDA resource.
memset(&bayerEglFrame, 0, sizeof(bayerEglFrame));
void *dptr = NULL;
cuResult = cuGraphicsResourceGetMappedEglFrame(&bayerEglFrame, bayerResource, 0, 0);
if (cuResult != CUDA_SUCCESS)
std::cout << "frame acquisition error: " << imgSize << std::endl;
std::cout << "Frame acquired: " << frameCount++ << std::endl;
cuEGLStreamConsumerReleaseFrame(&inputStreamConnection, bayerResource, NULL);
November 28, 2022, 8:46am
There is no method to call cuEGLStreamConsumerAcquireFrame(), cuGraphicsResourceGetMappedEglFrame() and map the data to NvBuffer. Please refer to 09_camera_jpeg_capture to call createNvBuffer() and copyToNvBuffer().
November 28, 2022, 9:15am
Okay. If I understand correctly, when we need NvBuffer, we can only use EGLStream::FrameConsumer from Argus.
And when we need raw pointer (for CUDA or CPU based processing), we can use EGLStreamKHR based consumer.
November 28, 2022, 12:47pm
If you only have CUDA processing in your use-case, you may use EGLStreamKHR based consumer. For other use-cases such as using hardware converter, encoder, CUDA processing altogether, please use EGLStream::FrameConsumer to have more flexibility.
November 28, 2022, 12:55pm
Thank you for confirming.
But this limits the use cases of EGL interoperability with Argus.
December 21, 2022, 1:05am
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.