+/*
+The getColorThreshold function is used to obtain a
+threshold usable for the fuzzyCompare function.
+
+For 8bit color depths a value of 0.02 should provide
+a good metric for rejecting images above this level.
+For other bit depths other thresholds should be selected.
+Ideally this function would take advantage of the
+getColorThreshold function provided by the PixelFormat class
+as this would also allow setting per channel thresholds.
+However using the PixelFormat provided function can result
+in too strict thresholds for 8bit bit depths (compared to
+the current default of 0.02) or too relaxed for lower bit
+depths if scaled proportionally to the 8bit default.
+*/
+
+float getColorThreshold (const tcu::PixelFormat& colorBits)
+{
+ if ((colorBits.redBits > 0 && colorBits.redBits < 8) ||
+ (colorBits.greenBits > 0 && colorBits.greenBits < 8) ||
+ (colorBits.blueBits > 0 && colorBits.blueBits < 8) ||
+ (colorBits.alphaBits > 0 && colorBits.alphaBits < 8))
+ {
+ return 0.05f;
+ }
+ else
+ {
+ return 0.02f;
+ }
+}
+