1 #ifndef _TCUIMAGECOMPARE_HPP 2 #define _TCUIMAGECOMPARE_HPP 3 /*------------------------------------------------------------------------- 4 * drawElements Quality Program Tester Core 5 * ---------------------------------------- 6 * 7 * Copyright 2014 The Android Open Source Project 8 * 9 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * you may not use this file except in compliance with the License. 11 * You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 * 21 *//*! 22 * \file 23 * \brief Image comparison utilities. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "tcuVectorType.hpp" 28 29 namespace tcu 30 { 31 32 class RGBA; 33 class Surface; 34 class ConstPixelBufferAccess; 35 class TestLog; 36 37 enum CompareLogMode 38 { 39 COMPARE_LOG_EVERYTHING = 0, //!< Always log both reference, result and error mask. 40 COMPARE_LOG_RESULT, //!< If comparison passes, log result only. If fails, everything is written to log. 41 COMPARE_LOG_ON_ERROR, //!< If comparison passes, nothing is logged. If fails, everything is written to log. 42 43 COMPARE_LOG_LAST 44 }; 45 46 // Utilities for comparing and logging. 47 bool pixelThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Surface &reference, 48 const Surface &result, const RGBA &threshold, CompareLogMode logMode); 49 bool fuzzyCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Surface &reference, 50 const Surface &result, float threshold, CompareLogMode logMode); 51 int measurePixelDiffAccuracy(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Surface &reference, 52 const Surface &result, int bestScoreDiff, int worstScoreDiff, CompareLogMode logMode); 53 54 bool fuzzyCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 55 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, float threshold, 56 CompareLogMode logMode); 57 bool bitwiseCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 58 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 59 CompareLogMode logMode); 60 bool floatUlpThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 61 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 62 const UVec4 &threshold, CompareLogMode logMode); 63 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 64 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 65 const Vec4 &threshold, CompareLogMode logMode); 66 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 67 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 68 const Vec4 &ignorekey, const Vec4 &threshold, CompareLogMode logMode); 69 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Vec4 &reference, 70 const ConstPixelBufferAccess &result, const Vec4 &threshold, CompareLogMode logMode); 71 bool intThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 72 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 73 const UVec4 &threshold, CompareLogMode logMode, bool use64Bits = false); 74 bool intThresholdPositionDeviationCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 75 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 76 const UVec4 &threshold, const tcu::IVec3 &maxPositionDeviation, 77 bool acceptOutOfBoundsAsAnyValue, CompareLogMode logMode); 78 bool intThresholdPositionDeviationErrorThresholdCompare( 79 TestLog &log, const char *imageSetName, const char *imageSetDesc, const ConstPixelBufferAccess &reference, 80 const ConstPixelBufferAccess &result, const UVec4 &threshold, const tcu::IVec3 &maxPositionDeviation, 81 bool acceptOutOfBoundsAsAnyValue, int maxAllowedFailingPixels, CompareLogMode logMode); 82 bool dsThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 83 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 84 const float threshold, CompareLogMode logMode); 85 int measurePixelDiffAccuracy(TestLog &log, const char *imageSetName, const char *imageSetDesc, 86 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 87 int bestScoreDiff, int worstScoreDiff, CompareLogMode logMode); 88 bool bilinearCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, 89 const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, 90 const RGBA threshold, CompareLogMode logMode); 91 92 } // namespace tcu 93 94 #endif // _TCUIMAGECOMPARE_HPP 95