aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-07-30 18:36:38 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-07-30 18:36:38 +0200
commit1f0c4fa2d65204ee7df255ca3eede12d6679eabe (patch)
treec66d702045225772c0a0963d122e4d614d7549c7
parent8a9204090319174d4178ae29fdfd7bc29f2355ae (diff)
qvidcap/v4l2-compliance: add support for new pixelformats
Add support for the following pixelformat variants: V4L2_PIX_FMT_RGBX32 V4L2_PIX_FMT_RGBA32 V4L2_PIX_FMT_BGRX32 V4L2_PIX_FMT_BGRA32 V4L2_PIX_FMT_XBGR444 V4L2_PIX_FMT_ABGR444 V4L2_PIX_FMT_RGBX444 V4L2_PIX_FMT_RGBA444 V4L2_PIX_FMT_BGRX444 V4L2_PIX_FMT_BGRA444 V4L2_PIX_FMT_RGBX555 V4L2_PIX_FMT_RGBA555 V4L2_PIX_FMT_XBGR555 V4L2_PIX_FMT_ABGR555 V4L2_PIX_FMT_BGRX555 V4L2_PIX_FMT_BGRA555 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/qvidcap/capture.cpp40
-rw-r--r--utils/qvidcap/paint.cpp120
-rw-r--r--utils/qvidcap/v4l2-convert.glsl29
-rw-r--r--utils/v4l2-compliance/v4l2-test-colors.cpp68
4 files changed, 236 insertions, 21 deletions
diff --git a/utils/qvidcap/capture.cpp b/utils/qvidcap/capture.cpp
index 5e1d5c58..a3a60511 100644
--- a/utils/qvidcap/capture.cpp
+++ b/utils/qvidcap/capture.cpp
@@ -60,9 +60,13 @@ const __u32 formats[] = {
V4L2_PIX_FMT_RGB32,
V4L2_PIX_FMT_XRGB32,
V4L2_PIX_FMT_ARGB32,
+ V4L2_PIX_FMT_RGBX32,
+ V4L2_PIX_FMT_RGBA32,
V4L2_PIX_FMT_BGR32,
V4L2_PIX_FMT_XBGR32,
V4L2_PIX_FMT_ABGR32,
+ V4L2_PIX_FMT_BGRX32,
+ V4L2_PIX_FMT_BGRA32,
V4L2_PIX_FMT_RGB24,
V4L2_PIX_FMT_BGR24,
V4L2_PIX_FMT_RGB565,
@@ -70,12 +74,24 @@ const __u32 formats[] = {
V4L2_PIX_FMT_RGB444,
V4L2_PIX_FMT_XRGB444,
V4L2_PIX_FMT_ARGB444,
+ V4L2_PIX_FMT_XBGR444,
+ V4L2_PIX_FMT_ABGR444,
+ V4L2_PIX_FMT_RGBX444,
+ V4L2_PIX_FMT_RGBA444,
+ V4L2_PIX_FMT_BGRX444,
+ V4L2_PIX_FMT_BGRA444,
V4L2_PIX_FMT_RGB555,
V4L2_PIX_FMT_XRGB555,
V4L2_PIX_FMT_ARGB555,
V4L2_PIX_FMT_RGB555X,
V4L2_PIX_FMT_XRGB555X,
V4L2_PIX_FMT_ARGB555X,
+ V4L2_PIX_FMT_RGBX555,
+ V4L2_PIX_FMT_RGBA555,
+ V4L2_PIX_FMT_XBGR555,
+ V4L2_PIX_FMT_ABGR555,
+ V4L2_PIX_FMT_BGRX555,
+ V4L2_PIX_FMT_BGRA555,
V4L2_PIX_FMT_RGB332,
V4L2_PIX_FMT_BGR666,
V4L2_PIX_FMT_SBGGR8,
@@ -679,6 +695,12 @@ bool CaptureWin::supportedFmt(__u32 fmt)
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
case V4L2_PIX_FMT_YUV555:
case V4L2_PIX_FMT_RGB332:
case V4L2_PIX_FMT_BGR666:
@@ -872,15 +894,25 @@ bool CaptureWin::updateV4LFormat(const cv4l_fmt &fmt)
case V4L2_PIX_FMT_BGR666:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB565X:
- case V4L2_PIX_FMT_ARGB444:
case V4L2_PIX_FMT_RGB444:
case V4L2_PIX_FMT_XRGB444:
+ case V4L2_PIX_FMT_ARGB444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_BGRA444:
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_XRGB32:
case V4L2_PIX_FMT_ARGB32:
+ case V4L2_PIX_FMT_RGBX32:
+ case V4L2_PIX_FMT_RGBA32:
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ABGR32:
+ case V4L2_PIX_FMT_BGRX32:
+ case V4L2_PIX_FMT_BGRA32:
m_accepts_srgb = false;
/* fall through */
case V4L2_PIX_FMT_RGB24:
@@ -891,6 +923,12 @@ bool CaptureWin::updateV4LFormat(const cv4l_fmt &fmt)
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
case V4L2_PIX_FMT_RGB332:
break;
default:
diff --git a/utils/qvidcap/paint.cpp b/utils/qvidcap/paint.cpp
index 547ad07a..e4fd17c4 100644
--- a/utils/qvidcap/paint.cpp
+++ b/utils/qvidcap/paint.cpp
@@ -195,9 +195,21 @@ void CaptureWin::paintGL()
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
case V4L2_PIX_FMT_RGB444:
case V4L2_PIX_FMT_XRGB444:
case V4L2_PIX_FMT_ARGB444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_BGRA444:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB565X:
case V4L2_PIX_FMT_RGB24:
@@ -208,6 +220,10 @@ void CaptureWin::paintGL()
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
+ case V4L2_PIX_FMT_RGBX32:
+ case V4L2_PIX_FMT_BGRX32:
+ case V4L2_PIX_FMT_RGBA32:
+ case V4L2_PIX_FMT_BGRA32:
case V4L2_PIX_FMT_HSV24:
case V4L2_PIX_FMT_HSV32:
default:
@@ -342,9 +358,13 @@ static const struct define defines[] = {
DEF(V4L2_PIX_FMT_RGB32),
DEF(V4L2_PIX_FMT_XRGB32),
DEF(V4L2_PIX_FMT_ARGB32),
+ DEF(V4L2_PIX_FMT_RGBX32),
+ DEF(V4L2_PIX_FMT_RGBA32),
DEF(V4L2_PIX_FMT_BGR32),
DEF(V4L2_PIX_FMT_XBGR32),
DEF(V4L2_PIX_FMT_ABGR32),
+ DEF(V4L2_PIX_FMT_BGRX32),
+ DEF(V4L2_PIX_FMT_BGRA32),
DEF(V4L2_PIX_FMT_RGB24),
DEF(V4L2_PIX_FMT_BGR24),
DEF(V4L2_PIX_FMT_RGB565),
@@ -352,12 +372,24 @@ static const struct define defines[] = {
DEF(V4L2_PIX_FMT_RGB444),
DEF(V4L2_PIX_FMT_XRGB444),
DEF(V4L2_PIX_FMT_ARGB444),
+ DEF(V4L2_PIX_FMT_XBGR444),
+ DEF(V4L2_PIX_FMT_ABGR444),
+ DEF(V4L2_PIX_FMT_RGBX444),
+ DEF(V4L2_PIX_FMT_RGBA444),
+ DEF(V4L2_PIX_FMT_BGRX444),
+ DEF(V4L2_PIX_FMT_BGRA444),
DEF(V4L2_PIX_FMT_RGB555),
DEF(V4L2_PIX_FMT_XRGB555),
DEF(V4L2_PIX_FMT_ARGB555),
DEF(V4L2_PIX_FMT_RGB555X),
DEF(V4L2_PIX_FMT_XRGB555X),
DEF(V4L2_PIX_FMT_ARGB555X),
+ DEF(V4L2_PIX_FMT_RGBX555),
+ DEF(V4L2_PIX_FMT_RGBA555),
+ DEF(V4L2_PIX_FMT_XBGR555),
+ DEF(V4L2_PIX_FMT_ABGR555),
+ DEF(V4L2_PIX_FMT_BGRX555),
+ DEF(V4L2_PIX_FMT_BGRA555),
DEF(V4L2_PIX_FMT_RGB332),
DEF(V4L2_PIX_FMT_BGR666),
DEF(V4L2_PIX_FMT_SBGGR8),
@@ -599,15 +631,27 @@ void CaptureWin::changeShader()
case V4L2_PIX_FMT_RGB332:
case V4L2_PIX_FMT_BGR666:
- case V4L2_PIX_FMT_RGB555:
- case V4L2_PIX_FMT_XRGB555:
- case V4L2_PIX_FMT_ARGB555:
case V4L2_PIX_FMT_RGB444:
case V4L2_PIX_FMT_XRGB444:
case V4L2_PIX_FMT_ARGB444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_BGRA444:
+ case V4L2_PIX_FMT_RGB555:
+ case V4L2_PIX_FMT_XRGB555:
+ case V4L2_PIX_FMT_ARGB555:
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB565X:
case V4L2_PIX_FMT_RGB24:
@@ -618,6 +662,10 @@ void CaptureWin::changeShader()
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
+ case V4L2_PIX_FMT_RGBX32:
+ case V4L2_PIX_FMT_BGRX32:
+ case V4L2_PIX_FMT_RGBA32:
+ case V4L2_PIX_FMT_BGRA32:
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y10:
case V4L2_PIX_FMT_Y12:
@@ -745,27 +793,43 @@ void CaptureWin::shader_RGB()
GLint internalFmt = m_accepts_srgb ? GL_SRGB8_ALPHA8 : GL_RGBA8;
switch (m_v4l_fmt.g_pixelformat()) {
- case V4L2_PIX_FMT_ARGB555:
case V4L2_PIX_FMT_RGB555:
case V4L2_PIX_FMT_XRGB555:
+ case V4L2_PIX_FMT_ARGB555:
glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
break;
- case V4L2_PIX_FMT_ARGB444:
case V4L2_PIX_FMT_RGB444:
+ case V4L2_PIX_FMT_ARGB444:
case V4L2_PIX_FMT_XRGB444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_BGRA444:
+ case V4L2_PIX_FMT_BGRX444:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA4, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, NULL);
break;
- case V4L2_PIX_FMT_ARGB555X:
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
+ case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
break;
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
+ glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
+ GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, NULL);
+ break;
+
case V4L2_PIX_FMT_BGR666:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, NULL);
@@ -781,13 +845,17 @@ void CaptureWin::shader_RGB()
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, NULL);
break;
- case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_RGB32:
+ case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_XRGB32:
+ case V4L2_PIX_FMT_RGBA32:
+ case V4L2_PIX_FMT_RGBX32:
case V4L2_PIX_FMT_HSV32:
- case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_BGR32:
+ case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_XBGR32:
+ case V4L2_PIX_FMT_BGRA32:
+ case V4L2_PIX_FMT_BGRX32:
glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
break;
@@ -1064,17 +1132,16 @@ void CaptureWin::render_RGB(__u32 format)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
GL_RGB, GL_UNSIGNED_BYTE_3_3_2, m_curData[0]);
break;
- case V4L2_PIX_FMT_RGB555:
- case V4L2_PIX_FMT_XRGB555:
- case V4L2_PIX_FMT_ARGB555:
- glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 2);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
- GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, m_curData[0]);
- break;
case V4L2_PIX_FMT_RGB444:
case V4L2_PIX_FMT_XRGB444:
case V4L2_PIX_FMT_ARGB444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_BGRA444:
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 2);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, m_curData[0]);
@@ -1100,6 +1167,16 @@ void CaptureWin::render_RGB(__u32 format)
GL_RED_INTEGER, GL_UNSIGNED_SHORT, m_curData[0]);
break;
+ case V4L2_PIX_FMT_RGB555:
+ case V4L2_PIX_FMT_XRGB555:
+ case V4L2_PIX_FMT_ARGB555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 2);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
+ GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, m_curData[0]);
+ break;
+
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
@@ -1113,6 +1190,15 @@ void CaptureWin::render_RGB(__u32 format)
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
break;
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 2);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
+ GL_BGRA, GL_UNSIGNED_SHORT_5_5_5_1, m_curData[0]);
+ break;
+
case V4L2_PIX_FMT_RGB565:
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 2);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
@@ -1133,10 +1219,14 @@ void CaptureWin::render_RGB(__u32 format)
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_XRGB32:
case V4L2_PIX_FMT_ARGB32:
+ case V4L2_PIX_FMT_RGBX32:
+ case V4L2_PIX_FMT_RGBA32:
case V4L2_PIX_FMT_HSV32:
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_ABGR32:
+ case V4L2_PIX_FMT_BGRX32:
+ case V4L2_PIX_FMT_BGRA32:
glPixelStorei(GL_UNPACK_ROW_LENGTH, m_v4l_fmt.g_bytesperline() / 4);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(),
GL_RGBA, GL_UNSIGNED_BYTE, m_curData[0]);
diff --git a/utils/qvidcap/v4l2-convert.glsl b/utils/qvidcap/v4l2-convert.glsl
index 8f80a903..458901c4 100644
--- a/utils/qvidcap/v4l2-convert.glsl
+++ b/utils/qvidcap/v4l2-convert.glsl
@@ -139,18 +139,37 @@ void main()
urgb.g = texture(tex, vec2((cell.y == xy.y) ? cell.x + texl_w : cell.x, xy.y)).r;
urgb.r = texture(tex, cell).r;
#elif PIXFMT == V4L2_PIX_FMT_RGB32 || PIXFMT == V4L2_PIX_FMT_XRGB32 || PIXFMT == V4L2_PIX_FMT_ARGB32 || \
- PIXFMT == V4L2_PIX_FMT_RGB444 || PIXFMT == V4L2_PIX_FMT_XRGB444 || PIXFMT == V4L2_PIX_FMT_ARGB444
+ PIXFMT == V4L2_PIX_FMT_RGB444 || PIXFMT == V4L2_PIX_FMT_XRGB444 || PIXFMT == V4L2_PIX_FMT_ARGB444
vec4 cell = texture(tex, xy);
#if V4L2_PIX_FMT_ARGB444 || PIXFMT == V4L2_PIX_FMT_ARGB32
alpha = cell.r;
#endif
rgb.rgb = cell.gba;
-#elif PIXFMT == V4L2_PIX_FMT_BGR32 || PIXFMT == V4L2_PIX_FMT_XBGR32 || PIXFMT == V4L2_PIX_FMT_ABGR32
+#elif PIXFMT == V4L2_PIX_FMT_BGR32 || PIXFMT == V4L2_PIX_FMT_XBGR32 || PIXFMT == V4L2_PIX_FMT_ABGR32 || \
+ PIXFMT == V4L2_PIX_FMT_BGRX444 || PIXFMT == V4L2_PIX_FMT_BGRA444 || \
+ PIXFMT == V4L2_PIX_FMT_XBGR555 || PIXFMT == V4L2_PIX_FMT_ABGR555 || \
+ PIXFMT == V4L2_PIX_FMT_RGBX555 || PIXFMT == V4L2_PIX_FMT_RGBA555
vec4 cell = texture(tex, xy);
-#if PIXFMT == V4L2_PIX_FMT_ABGR32
+#if PIXFMT == V4L2_PIX_FMT_ABGR32 || PIXFMT == V4L2_PIX_FMT_BGRA444 || PIXFMT == V4L2_PIX_FMT_RGBA555 || PIXFMT == V4L2_PIX_FMT_ABGR555
alpha = cell.a;
#endif
rgb.rgb = cell.bgr;
+#elif PIXFMT == V4L2_PIX_FMT_RGBX32 || PIXFMT == V4L2_PIX_FMT_RGBA32 || \
+ PIXFMT == V4L2_PIX_FMT_RGBX444 || PIXFMT == V4L2_PIX_FMT_RGBA444 || \
+ PIXFMT == V4L2_PIX_FMT_RGB555 || PIXFMT == V4L2_PIX_FMT_XRGB555 || PIXFMT == V4L2_PIX_FMT_ARGB555 || \
+ PIXFMT == V4L2_PIX_FMT_BGRX555 || PIXFMT == V4L2_PIX_FMT_BGRA555
+ vec4 cell = texture(tex, xy);
+#if PIXFMT == V4L2_PIX_FMT_RGBA32 || PIXFMT == V4L2_PIX_FMT_RGBA444 || PIXFMT == V4L2_PIX_FMT_ARGB555 || PIXFMT == V4L2_PIX_FMT_BGRA555
+ alpha = cell.a;
+#endif
+ rgb.rgb = cell.rgb;
+#elif PIXFMT == V4L2_PIX_FMT_BGRX32 || PIXFMT == V4L2_PIX_FMT_BGRA32 || \
+ PIXFMT == V4L2_PIX_FMT_XBGR444 || PIXFMT == V4L2_PIX_FMT_ABGR444
+ vec4 cell = texture(tex, xy);
+#if PIXFMT == V4L2_PIX_FMT_BGRA32 || PIXFMT == V4L2_PIX_FMT_ABGR444
+ alpha = cell.r;
+#endif
+ rgb.rgb = cell.abg;
#elif PIXFMT == V4L2_PIX_FMT_GREY
rgb.rgb = vec3(float(texture(tex, xy).r) / 255.0);
#elif PIXFMT == V4L2_PIX_FMT_Y10
@@ -167,7 +186,9 @@ void main()
vec4 color = texture(tex, xy);
// RGB pixel formats with an alpha component
-#if PIXFMT == V4L2_PIX_FMT_ARGB555 || PIXFMT == V4L2_PIX_FMT_ARGB555X
+#if PIXFMT == V4L2_PIX_FMT_ARGB555 || PIXFMT == V4L2_PIX_FMT_ARGB555X || \
+ PIXFMT == V4L2_PIX_FMT_RGBA555 || PIXFMT == V4L2_PIX_FMT_ABGR555 || \
+ PIXFMT == V4L2_PIX_FMT_BGRA555
alpha = color.a;
#endif
diff --git a/utils/v4l2-compliance/v4l2-test-colors.cpp b/utils/v4l2-compliance/v4l2-test-colors.cpp
index 7c62dc72..de4dd184 100644
--- a/utils/v4l2-compliance/v4l2-test-colors.cpp
+++ b/utils/v4l2-compliance/v4l2-test-colors.cpp
@@ -133,6 +133,48 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
case V4L2_PIX_FMT_ARGB555X:
v16 = p8[2 * x + 1] + (p8[2 * x] << 8);
break;
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_RGBA555:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = ((v16 & 1) << 15) | (v16 >> 1);
+ break;
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_ABGR555:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = (v16 & 0x8000) |
+ ((v16 & 0x001f) << 10) |
+ (v16 & 0x03e0) |
+ ((v16 & 0x7c00) >> 10);
+ break;
+ case V4L2_PIX_FMT_BGRX555:
+ case V4L2_PIX_FMT_BGRA555:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = ((v16 & 1) << 15) |
+ ((v16 & 0x003e) << 9) |
+ (v16 & 0x07c0) |
+ ((v16 & 0xf800) >> 11);
+ break;
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_ABGR444:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = (v16 & 0xf000) |
+ ((v16 & 0x0f00) >> 8) |
+ (v16 & 0x00f0) |
+ ((v16 & 0x000f) << 8);
+ break;
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_RGBA444:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = ((v16 & 0xf) << 12) | ((v16 >> 4) & 0xfff);
+ break;
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_BGRA444:
+ v16 = p8[2 * x] + (p8[2 * x + 1] << 8);
+ v16 = ((v16 & 0x000f) << 12) |
+ ((v16 & 0x00f0) << 4) |
+ ((v16 & 0x0f00) >> 4) |
+ ((v16 & 0xf000) >> 12);
+ break;
case V4L2_PIX_FMT_RGB24:
v32 = p8[3 * x + 2] + (p8[3 * x + 1] << 8) +
(p8[3 * x] << 16);
@@ -163,6 +205,16 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
v32 = p8[4 * x] + (p8[4 * x + 1] << 8) +
(p8[4 * x + 2] << 16) + (p8[4 * x + 3] << 24);
break;
+ case V4L2_PIX_FMT_RGBX32:
+ case V4L2_PIX_FMT_RGBA32:
+ v32 = p8[4 * x + 2] + (p8[4 * x + 1] << 8) +
+ (p8[4 * x] << 16) + (p8[4 * x + 3] << 24);
+ break;
+ case V4L2_PIX_FMT_BGRX32:
+ case V4L2_PIX_FMT_BGRA32:
+ v32 = p8[4 * x + 1] + (p8[4 * x + 2] << 8) +
+ (p8[4 * x + 3] << 16) + (p8[4 * x] << 24);
+ break;
case V4L2_PIX_FMT_SBGGR8:
p8 = planes[0] + bpl * yeven + xeven;
v32 = p8[0] + (p8[(y & 1) * bpl + 1 - (y & 1)] << 8) + (p8[bpl + 1] << 16);
@@ -272,17 +324,26 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
c.b = (v16 & 0x1f) / 31.0;
break;
case V4L2_PIX_FMT_ARGB444:
+ case V4L2_PIX_FMT_ABGR444:
+ case V4L2_PIX_FMT_RGBA444:
+ case V4L2_PIX_FMT_BGRA444:
c.a = (v16 >> 12) / 15.0;
/* fall through */
- case V4L2_PIX_FMT_YUV444:
case V4L2_PIX_FMT_RGB444:
case V4L2_PIX_FMT_XRGB444:
+ case V4L2_PIX_FMT_XBGR444:
+ case V4L2_PIX_FMT_RGBX444:
+ case V4L2_PIX_FMT_BGRX444:
+ case V4L2_PIX_FMT_YUV444:
c.r = ((v16 >> 8) & 0xf) / 15.0;
c.g = ((v16 >> 4) & 0xf) / 15.0;
c.b = (v16 & 0xf) / 15.0;
break;
case V4L2_PIX_FMT_ARGB555:
case V4L2_PIX_FMT_ARGB555X:
+ case V4L2_PIX_FMT_RGBA555:
+ case V4L2_PIX_FMT_ABGR555:
+ case V4L2_PIX_FMT_BGRA555:
c.a = v16 >> 15;
/* fall through */
case V4L2_PIX_FMT_YUV555:
@@ -290,6 +351,9 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
case V4L2_PIX_FMT_XRGB555:
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
+ case V4L2_PIX_FMT_RGBX555:
+ case V4L2_PIX_FMT_XBGR555:
+ case V4L2_PIX_FMT_BGRX555:
c.r = ((v16 >> 10) & 0x1f) / 31.0;
c.g = ((v16 >> 5) & 0x1f) / 31.0;
c.b = (v16 & 0x1f) / 31.0;
@@ -309,6 +373,8 @@ static void getColor(const cv4l_fmt &fmt, __u8 * const planes[3],
break;
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
+ case V4L2_PIX_FMT_RGBA32:
+ case V4L2_PIX_FMT_BGRA32:
c.a = ((v32 >> 24) & 0xff) / 255.0;
/* fall through */
default:

Privacy Policy