The issue with EGLStream rendering using Argus.
I try present frame using cuEGLStreamProducerPresentFrame with RGB after nppiCFAToRGB_8u_C1C3R
or with RGBA after nppiCFAToRGBA_8u_C1AC4R.
Here is the RGB setup:
CUeglFrame frame_rgb;
int rgb_buffer_step;
Npp8u *rgb_buffer = nppiMalloc_8u_C3(FULL_HD.width(), FULL_HD.height(), &rgb_buffer_step);
assertNullAllocation(rgb_buffer, rgb_buffer_step); // checks for NULL and insane step
frame_rgb.planeCount = 1;
frame_rgb.numChannels = 3;
frame_rgb.width = FULL_HD.width();
frame_rgb.height = FULL_HD.height();
frame_rgb.depth = 1;
frame_rgb.pitch = rgb_buffer_step;
frame_rgb.cuFormat = CU_AD_FORMAT_UNSIGNED_INT8;
frame_rgb.eglColorFormat = CU_EGL_COLOR_FORMAT_RGB;
frame_rgb.frameType = CU_EGL_FRAME_TYPE_PITCH;
frame_rgb.frame.pPitch[0] = rgb_buffer;
RGBA setup:
CUeglFrame frame_rgba;
int rgba_buffer_step;
Npp8u *rgba_buffer = nppiMalloc_8u_C4(FULL_HD.width(), FULL_HD.height(), &rgba_buffer_step);
assertNullAllocation(rgba_buffer, rgba_buffer_step); // checks for NULL and insane step
frame_rgba.planeCount = 1;
frame_rgba.numChannels = 4;
frame_rgba.width = FULL_HD.width();
frame_rgba.height = FULL_HD.height();
frame_rgba.depth = 1;
frame_rgba.pitch = rgba_buffer_step;
frame_rgba.cuFormat = CU_AD_FORMAT_UNSIGNED_INT8;
frame_rgba.eglColorFormat = CU_EGL_COLOR_FORMAT_RGBA;
frame_rgba.frameType = CU_EGL_FRAME_TYPE_PITCH;
frame_rgba.frame.pPitch[0] = rgba_buffer;
For that frames ArgusSamples::PreviewConsumerThread shows nothing (data exists it is copied and encoded with H264 in parallel) and writes :
PREVIEW CONSUMER: Producer(s) connected; continuing.
PREVIEW CONSUMER: Acquired frame 1. Rendering.
PREVIEW CONSUMER: Acquired frame 2. Rendering.
PREVIEW CONSUMER: GL error 1285
PREVIEW CONSUMER: Acquired frame 3. Rendering.
PREVIEW CONSUMER: GL error 1285
1285 is a GL_OUT_OF_MEMORY error.
I did try to use cuMemAlloc instead of NPP allocator. It shows the same issue. Rendering of CU_EGL_COLOR_FORMAT_YUV420_PLANAR with cuArray3DCreate allocated frame memory goes well. But it requires additional nppiRGBToYCbCr_8u_P3R and pack steps so it decreases FPS.