common: utils: Add last 3 16-bit bayer formats
PATCH 1/4 common: utils: Add last 3 16-bit bayer formats
From: Bård Eirik Winther <[email protected]>
Add the remaining 16-bit bayer formats to rle_calc_bpl, namely:
V4L2_PIX_FMT_SGBRG16
V4L2_PIX_FMT_SGRBG16
V4L2_PIX_FMT_SRGGB16
Signed-off-by Bård Eirik Winther <[email protected]>
--- utils/common/v4l-stream.c | 3 +++ 1 file changed, 3 insertions(+)
utils/common/v4l-stream.c +3 -0
@@ -51,6 +51,9 @@ unsigned rle_calc_bpl(unsigned bpl, __u32 pixelformat)case V4L2_PIX_FMT_SGRBG12 :case V4L2_PIX_FMT_SRGGB12 :case V4L2_PIX_FMT_SBGGR16 : +case V4L2_PIX_FMT_SGBRG16 : +case V4L2_PIX_FMT_SGRBG16 : +case V4L2_PIX_FMT_SRGGB16 :return 2 * bpl;default :return bpl;
Signature · 1 line
2.17.1
PATCH 2/4 qvidcap: Add 16-bit bayer rendering
From: Bård Eirik Winther <[email protected]>
Add OpenGL support to render all v4l2 16-bit bayer formats
Signed-off-by Bård Eirik Winther <[email protected]>
--- utils/qvidcap/capture-win-gl.cpp | 28 ++++++++++++++++++++++++++++ utils/qvidcap/v4l2-convert.glsl | 13 +++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-)
utils/qvidcap/capture-win-gl.cpp +28 -0
@@ -86,6 +86,10 @@ const __u32 formats[] = { V4L2_PIX_FMT_SGBRG12, V4L2_PIX_FMT_SGRBG12, V4L2_PIX_FMT_SRGGB12, + V4L2_PIX_FMT_SBGGR16, + V4L2_PIX_FMT_SGBRG16, + V4L2_PIX_FMT_SGRBG16, + V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_HSV24, V4L2_PIX_FMT_HSV32, V4L2_PIX_FMT_GREY,
@@ -842,6 +846,10 @@ bool CaptureGLWin::updateV4LFormat(const cv4l_fmt &fmt) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: m_is_bayer = true; /* fall through */ case V4L2_PIX_FMT_GREY:
@@ -1625,6 +1633,10 @@ void CaptureGLWin::paintGL() case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: render_Bayer(m_v4l_fmt.g_pixelformat()); break;
@@ -1815,6 +1827,10 @@ static const struct define defines[] = { DEF(V4L2_PIX_FMT_SGBRG12), DEF(V4L2_PIX_FMT_SGRBG12), DEF(V4L2_PIX_FMT_SRGGB12), + DEF(V4L2_PIX_FMT_SBGGR16), + DEF(V4L2_PIX_FMT_SGBRG16), + DEF(V4L2_PIX_FMT_SGRBG16), + DEF(V4L2_PIX_FMT_SRGGB16), DEF(V4L2_PIX_FMT_HSV24), DEF(V4L2_PIX_FMT_HSV32), DEF(V4L2_PIX_FMT_GREY),
@@ -2025,6 +2041,10 @@ void CaptureGLWin::changeShader() case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: shader_Bayer(); break;
@@ -2272,6 +2292,10 @@ void CaptureGLWin::shader_Bayer() case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: glTexImage2D(GL_TEXTURE_2D, 0, GL_R16UI, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, NULL); break;
@@ -2611,6 +2635,10 @@ void CaptureGLWin::render_Bayer(__u32 format) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_v4l_fmt.g_width(), m_v4l_fmt.g_height(), GL_RED_INTEGER, GL_UNSIGNED_SHORT, m_curData[0]); break;
utils/qvidcap/v4l2-convert.glsl +9 -4
@@ -5,6 +5,8 @@ PIXFMT == V4L2_PIX_FMT_SGRBG10 || PIXFMT == V4L2_PIX_FMT_SRGGB10 || \ PIXFMT == V4L2_PIX_FMT_SBGGR12 || PIXFMT == V4L2_PIX_FMT_SGBRG12 || \ PIXFMT == V4L2_PIX_FMT_SGRBG12 || PIXFMT == V4L2_PIX_FMT_SRGGB12 || \ + PIXFMT == V4L2_PIX_FMT_SBGGR16 || PIXFMT == V4L2_PIX_FMT_SGBRG16 || \ + PIXFMT == V4L2_PIX_FMT_SGRBG16 || PIXFMT == V4L2_PIX_FMT_SRGGB16 || \ PIXFMT == V4L2_PIX_FMT_GREY || PIXFMT == V4L2_PIX_FMT_Y16 || \ PIXFMT == V4L2_PIX_FMT_Y16_BE || PIXFMT == V4L2_PIX_FMT_Z16 || \ PIXFMT == V4L2_PIX_FMT_Y10 || PIXFMT == V4L2_PIX_FMT_Y12
@@ -112,25 +114,25 @@ void main() #if IS_RGB // Bayer pixel formats -#if PIXFMT == V4L2_PIX_FMT_SBGGR8 || PIXFMT == V4L2_PIX_FMT_SBGGR10 || PIXFMT == V4L2_PIX_FMT_SBGGR12 +#if PIXFMT == V4L2_PIX_FMT_SBGGR8 || PIXFMT == V4L2_PIX_FMT_SBGGR10 || PIXFMT == V4L2_PIX_FMT_SBGGR12 || PIXFMT == V4L2_PIX_FMT_SBGGR16 uvec4 urgb; vec2 cell = vec2(xeven ? xy.x : xy.x - texl_w, yeven ? xy.y : xy.y - texl_h); urgb.r = texture(tex, vec2(cell.x + texl_w, cell.y + texl_h)).r; urgb.g = texture(tex, vec2((cell.y == xy.y) ? cell.x + texl_w : cell.x, xy.y)).r; urgb.b = texture(tex, cell).r; -#elif PIXFMT == V4L2_PIX_FMT_SGBRG8 || PIXFMT == V4L2_PIX_FMT_SGBRG10 || PIXFMT == V4L2_PIX_FMT_SGBRG12 +#elif PIXFMT == V4L2_PIX_FMT_SGBRG8 || PIXFMT == V4L2_PIX_FMT_SGBRG10 || PIXFMT == V4L2_PIX_FMT_SGBRG12 || PIXFMT == V4L2_PIX_FMT_SGBRG16 uvec4 urgb; vec2 cell = vec2(xeven ? xy.x : xy.x - texl_w, yeven ? xy.y : xy.y - texl_h); urgb.r = texture(tex, vec2(cell.x, cell.y + texl_h)).r; urgb.g = texture(tex, vec2((cell.y == xy.y) ? cell.x : cell.x + texl_w, xy.y)).r; urgb.b = texture(tex, vec2(cell.x + texl_w, cell.y)).r; -#elif PIXFMT == V4L2_PIX_FMT_SGRBG8 || PIXFMT == V4L2_PIX_FMT_SGRBG10 || PIXFMT == V4L2_PIX_FMT_SGRBG12 +#elif PIXFMT == V4L2_PIX_FMT_SGRBG8 || PIXFMT == V4L2_PIX_FMT_SGRBG10 || PIXFMT == V4L2_PIX_FMT_SGRBG12 || PIXFMT == V4L2_PIX_FMT_SGRBG16 uvec4 urgb; vec2 cell = vec2(xeven ? xy.x : xy.x - texl_w, yeven ? xy.y : xy.y - texl_h); urgb.r = texture(tex, vec2(cell.x + texl_w, cell.y)).r; urgb.g = texture(tex, vec2((cell.y == xy.y) ? cell.x : cell.x + texl_w, xy.y)).r; urgb.b = texture(tex, vec2(cell.x, cell.y + texl_h)).r; -#elif PIXFMT == V4L2_PIX_FMT_SRGGB8 || PIXFMT == V4L2_PIX_FMT_SRGGB10 || PIXFMT == V4L2_PIX_FMT_SRGGB12 +#elif PIXFMT == V4L2_PIX_FMT_SRGGB8 || PIXFMT == V4L2_PIX_FMT_SRGGB10 || PIXFMT == V4L2_PIX_FMT_SRGGB12 || PIXFMT == V4L2_PIX_FMT_SRGGB16 uvec4 urgb; vec2 cell = vec2(xeven ? xy.x : xy.x - texl_w, yeven ? xy.y : xy.y - texl_h); urgb.b = texture(tex, vec2(cell.x + texl_w, cell.y + texl_h)).r;
@@ -192,6 +194,9 @@ void main() #elif PIXFMT == V4L2_PIX_FMT_SBGGR12 || PIXFMT == V4L2_PIX_FMT_SGBRG12 || \ PIXFMT == V4L2_PIX_FMT_SGRBG12 || PIXFMT == V4L2_PIX_FMT_SRGGB12 rgb = vec3(urgb) / 4095.0; +#elif PIXFMT == V4L2_PIX_FMT_SBGGR16 || PIXFMT == V4L2_PIX_FMT_SGBRG16 || \ + PIXFMT == V4L2_PIX_FMT_SGRBG16 || PIXFMT == V4L2_PIX_FMT_SRGGB16 + rgb = vec3(urgb) / 65535.0; #endif #if QUANT == V4L2_QUANTIZATION_LIM_RANGE
Signature · 1 line
2.17.1
PATCH 3/4 qv4l2: Add 16-bit bayer rendering
In reply to [email protected]From: Bård Eirik Winther <[email protected]>
Add OpenGL support to render all v4l2 16-bit bayer formats
Signed-off-by Bård Eirik Winther <[email protected]>
--- utils/qv4l2/capture-win-gl.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
utils/qv4l2/capture-win-gl.cpp +24 -0
@@ -369,6 +369,10 @@ bool CaptureWinGLEngine::hasNativeFormat(__u32 format) V4L2_PIX_FMT_SGBRG12, V4L2_PIX_FMT_SGRBG12, V4L2_PIX_FMT_SRGGB12, + V4L2_PIX_FMT_SBGGR16, + V4L2_PIX_FMT_SGBRG16, + V4L2_PIX_FMT_SGRBG16, + V4L2_PIX_FMT_SRGGB16, V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_YVYU, V4L2_PIX_FMT_UYVY,
@@ -487,6 +491,10 @@ void CaptureWinGLEngine::changeShader() case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: shader_Bayer(m_frameFormat); break;
@@ -635,6 +643,10 @@ void CaptureWinGLEngine::paintGL() case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: render_Bayer(m_frameFormat); break;
@@ -1874,6 +1886,10 @@ void CaptureWinGLEngine::shader_Bayer(__u32 format) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: glTexImage2D(GL_TEXTURE_2D, 0, m_glRed16, m_frameWidth, m_frameHeight, 0, m_glRed, GL_UNSIGNED_SHORT, NULL); break;
@@ -1908,6 +1924,7 @@ void CaptureWinGLEngine::shader_Bayer(__u32 format) case V4L2_PIX_FMT_SBGGR8: case V4L2_PIX_FMT_SBGGR10: case V4L2_PIX_FMT_SBGGR12: + case V4L2_PIX_FMT_SBGGR16: codeHead += " r = texture2D(tex, vec2(cell.x + texl_w, cell.y + texl_h)).r;" " g = texture2D(tex, vec2((cell.y == xy.y) ? cell.x + texl_w : cell.x, xy.y)).r;" " b = texture2D(tex, cell).r;";
@@ -1915,6 +1932,7 @@ void CaptureWinGLEngine::shader_Bayer(__u32 format) case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGBRG10: case V4L2_PIX_FMT_SGBRG12: + case V4L2_PIX_FMT_SGBRG16: codeHead += " r = texture2D(tex, vec2(cell.x, cell.y + texl_h)).r;" " g = texture2D(tex, vec2((cell.y == xy.y) ? cell.x : cell.x + texl_w, xy.y)).r;" " b = texture2D(tex, vec2(cell.x + texl_w, cell.y)).r;";
@@ -1922,6 +1940,7 @@ void CaptureWinGLEngine::shader_Bayer(__u32 format) case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SGRBG10: case V4L2_PIX_FMT_SGRBG12: + case V4L2_PIX_FMT_SGRBG16: codeHead += " r = texture2D(tex, vec2(cell.x + texl_w, cell.y)).r;" " g = texture2D(tex, vec2((cell.y == xy.y) ? cell.x : cell.x + texl_w, xy.y)).r;" " b = texture2D(tex, vec2(cell.x, cell.y + texl_h)).r;";
@@ -1929,6 +1948,7 @@ void CaptureWinGLEngine::shader_Bayer(__u32 format) case V4L2_PIX_FMT_SRGGB8: case V4L2_PIX_FMT_SRGGB10: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SRGGB16: codeHead += " b = texture2D(tex, vec2(cell.x + texl_w, cell.y + texl_h)).r;" " g = texture2D(tex, vec2((cell.y == xy.y) ? cell.x + texl_w : cell.x, xy.y)).r;" " r = texture2D(tex, cell).r;";
@@ -2005,6 +2025,10 @@ void CaptureWinGLEngine::render_Bayer(__u32 format) case V4L2_PIX_FMT_SGBRG12: case V4L2_PIX_FMT_SGRBG12: case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR16: + case V4L2_PIX_FMT_SGBRG16: + case V4L2_PIX_FMT_SGRBG16: + case V4L2_PIX_FMT_SRGGB16: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight, m_glRed, GL_UNSIGNED_SHORT, m_frameData); break;
Signature · 1 line
2.17.1
PATCH 4/4 utils: Add qvidcap to configure status report
In reply to [email protected]From: Bård Eirik Winther <[email protected]>
Add missing build status flag for qvidcap to the configuration report
Signed-off-by Bård Eirik Winther <[email protected]>
--- configure.ac | 2 ++ 1 file changed, 2 insertions(+)
configure.ac +2 -0
@@ -518,6 +518,7 @@ AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes" AM_COND_IF([WITH_DYN_LIBV4L], [USE_DYN_LIBV4L="yes"], [USE_DYN_LIBV4L="no"]) AM_COND_IF([WITH_V4LUTILS], [USE_V4LUTILS="yes"], [USE_V4LUTILS="no"]) AM_COND_IF([WITH_QV4L2], [USE_QV4L2="yes"], [USE_QV4L2="no"]) +AM_COND_IF([WITH_QVIDCAP], [USE_QVIDCAP="yes"], [USE_QVIDCAP="no"]) AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes" AC_DEFINE([HAVE_V4L_PLUGINS], [1], [V4L plugin support enabled])], [USE_V4L_PLUGINS="no"])
@@ -566,6 +567,7 @@ compile time options summary dvbv5-daemon : $USE_DVBV5_REMOTE v4lutils : $USE_V4LUTILS qv4l2 : $USE_QV4L2 + qvidcap : $USE_QVIDCAP v4l2-ctl uses libv4l : $USE_V4L2_CTL_LIBV4L v4l2-compliance uses libv4l: $USE_V4L2_COMPLIANCE_LIBV4L EOF
Signature · 1 line
2.17.1