Hi,
in Vision SDK version : 2.8,
The input format is YUV420, the pixels are full range (0~255), we need to use GPU OpenGL API System_eglSetupYuvTexSurface, the expected output is RGB format pixels with full range (0~255).
that means : range was cutted when yuv witch to rgb.
we check it by this way:
After the function wraps YUV image into an external texture in the GL_TEXTURE_EXTERNAL_OES format,
The color sampled by the texture sampler is abnormal.
Channels with input values greater than 235 are sampled to 255 after sampling, and values less than 15 are clipped to 0.
function shows below:
{
EGLint attr[32];
int attrIdx;
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
attr[attrIdx++] = FOURCC_STR("NV12");
attr[attrIdx++] = pProp->width;
attr[attrIdx++] = pProp->height;
attr[attrIdx++] = pProp->pitch[0];
if(pProp->dataFormat==SYSTEM_DF_YUV420SP_UV)
{
attr[attrIdx++] = (pProp->pitch[0] * pProp->height * 3)/2;
}
else
{
INFO(" EGL: ERROR: Unsupported data format (%d) !!!\n", pProp->dataFormat);
assert(0);
}
attr[attrIdx++] = EGLIMAGE_FLAGS_YUV_CONFORMANT_RANGE | EGLIMAGE_FLAGS_YUV_BT601;
eglCreateImageKHR =
(PFNEGLCREATEIMAGEKHRPROC)eglGetProcAddress("eglCreateImageKHR");
glEGLImageTargetTexture2DOES =
(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES");
pObj->display,
EGL_NO_CONTEXT,
EGL_RAW_VIDEO_TI,
bufAddr,
attr
);
if (pObj->texImg[texIndex] == EGL_NO_IMAGE_KHR) {
INFO(" EGL: ERROR: eglCreateImageKHR failed !!!\n");
return -1;
}
System_eglCheckGlError("eglCreateImageKHR");
System_eglCheckGlError("glBindTexture");
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
System_eglCheckGlError("glTexParameteri");
System_eglCheckGlError("glEGLImageTargetTexture2DOES");
}
Thanks