Skip NaN values when estimating pixel value range.
authorMika Isojärvi <misojarvi@google.com>
Wed, 18 Feb 2015 19:32:59 +0000 (11:32 -0800)
committerMika Isojärvi <misojarvi@google.com>
Wed, 18 Feb 2015 19:50:25 +0000 (11:50 -0800)
Bug: 19379467
Change-Id: Idfb98ddd4bff47bb4cd6a77f6d4a870d303960a5

framework/common/tcuTextureUtil.cpp

index 97fbc9a..6224ae7 100644 (file)
@@ -888,15 +888,15 @@ void estimatePixelValueRange (const ConstPixelBufferAccess& access, Vec4& minVal
                                        {
                                                Vec4 p = access.getPixel(x, y, z);
 
-                                               minVal[0] = de::min(minVal[0], p[0]);
-                                               minVal[1] = de::min(minVal[1], p[1]);
-                                               minVal[2] = de::min(minVal[2], p[2]);
-                                               minVal[3] = de::min(minVal[3], p[3]);
-
-                                               maxVal[0] = de::max(maxVal[0], p[0]);
-                                               maxVal[1] = de::max(maxVal[1], p[1]);
-                                               maxVal[2] = de::max(maxVal[2], p[2]);
-                                               maxVal[3] = de::max(maxVal[3], p[3]);
+                                               minVal[0] = (deFloatIsNaN(p[0]) ? minVal[0] : de::min(minVal[0], p[0]));
+                                               minVal[1] = (deFloatIsNaN(p[1]) ? minVal[1] : de::min(minVal[1], p[1]));
+                                               minVal[2] = (deFloatIsNaN(p[2]) ? minVal[2] : de::min(minVal[2], p[2]));
+                                               minVal[3] = (deFloatIsNaN(p[3]) ? minVal[3] : de::min(minVal[3], p[3]));
+
+                                               maxVal[0] = (deFloatIsNaN(p[0]) ? maxVal[0] : de::max(maxVal[0], p[0]));
+                                               maxVal[1] = (deFloatIsNaN(p[1]) ? maxVal[1] : de::max(maxVal[1], p[1]));
+                                               maxVal[2] = (deFloatIsNaN(p[2]) ? maxVal[2] : de::max(maxVal[2], p[2]));
+                                               maxVal[3] = (deFloatIsNaN(p[3]) ? maxVal[3] : de::max(maxVal[3], p[3]));
                                        }
                                }
                        }