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.
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?
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.
CUeglFrame bayerEglFrame;
memset(&bayerEglFrame, 0, sizeof(bayerEglFrame));
void *dptr = NULL;
size_t imgSize;
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);
Hi,
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().
Hi,
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.