This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: qv4l2: fix power-of-negative-number
Author:  Hans Verkuil <[email protected]>
Date:    Sat Mar 12 13:52:30 2016 +0100

Several transfer functions use the pow() function where the base can be
negative which causes wrong colors. Make sure the base is always >= 0.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/qv4l2/capture-win-gl.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c84ba3a1db1c5ed219eafcd6fbaa8e9da867074a
diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index 49f8e5691d52..0cc2d8a8cbe7 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -772,22 +772,22 @@ QString CaptureWinGLEngine::codeTransformToLinear()
                               "        ((b <= 0.04045) ? b / 12.92 : pow((b + 
0.055) / 1.055, 2.4));"
                               );
        case V4L2_XFER_FUNC_ADOBERGB:
-               return QString("   r = pow(r, 2.19921875);"
-                              "   g = pow(g, 2.19921875);"
-                              "   b = pow(b, 2.19921875);");
+               return QString("   r = pow(max(r, 0.0), 2.19921875);"
+                              "   g = pow(max(g, 0.0), 2.19921875);"
+                              "   b = pow(max(b, 0.0), 2.19921875);");
        case V4L2_XFER_FUNC_DCI_P3:
-               return QString("   r = pow(r, 2.6);"
-                              "   g = pow(g, 2.6);"
-                              "   b = pow(b, 2.6);");
+               return QString("   r = pow(max(r, 0.0), 2.6);"
+                              "   g = pow(max(g, 0.0), 2.6);"
+                              "   b = pow(max(b, 0.0), 2.6);");
        case V4L2_XFER_FUNC_SMPTE2084:
                return QString("   float m1 = 1.0 / ((2610.0 / 4096.0) / 4.0);"
                               "   float m2 = 1.0 / (128.0 * 2523.0 / 4096.0);"
                               "   float c1 = 3424.0 / 4096.0;"
                               "   float c2 = 32.0 * 2413.0 / 4096.0;"
                               "   float c3 = 32.0 * 2392.0 / 4096.0;"
-                              "   r = pow(r, m2);"
-                              "   g = pow(g, m2);"
-                              "   b = pow(b, m2);"
+                              "   r = pow(max(r, 0.0), m2);"
+                              "   g = pow(max(g, 0.0), m2);"
+                              "   b = pow(max(b, 0.0), m2);"
                               "   r = pow(max(r - c1, 0.0) / (c2 - c3 * r), 
m1);"
                               "   g = pow(max(g - c1, 0.0) / (c2 - c3 * g), 
m1);"
                               "   b = pow(max(b - c1, 0.0) / (c2 - c3 * b), 
m1);");

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to