• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 bool fuzzyCompareMaxError(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Surface &reference,
52                           const Surface &result, float threshold, CompareLogMode logMode);
53 int measurePixelDiffAccuracy(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Surface &reference,
54                              const Surface &result, int bestScoreDiff, int worstScoreDiff, CompareLogMode logMode);
55 
56 bool fuzzyCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
57                   const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result, float threshold,
58                   CompareLogMode logMode);
59 bool bitwiseCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
60                     const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
61                     CompareLogMode logMode);
62 bool fuzzyCompareMaxError(TestLog &log, const char *imageSetName, const char *imageSetDesc,
63                           const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
64                           float threshold, CompareLogMode logMode);
65 bool floatUlpThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
66                               const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
67                               const UVec4 &threshold, CompareLogMode logMode);
68 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
69                            const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
70                            const Vec4 &threshold, CompareLogMode logMode);
71 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
72                            const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
73                            const Vec4 &ignorekey, const Vec4 &threshold, CompareLogMode logMode);
74 bool floatThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc, const Vec4 &reference,
75                            const ConstPixelBufferAccess &result, const Vec4 &threshold, CompareLogMode logMode);
76 bool intThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
77                          const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
78                          const UVec4 &threshold, CompareLogMode logMode, bool use64Bits = false);
79 bool intThresholdPositionDeviationCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
80                                           const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
81                                           const UVec4 &threshold, const tcu::IVec3 &maxPositionDeviation,
82                                           bool acceptOutOfBoundsAsAnyValue, CompareLogMode logMode);
83 bool intThresholdPositionDeviationErrorThresholdCompare(
84     TestLog &log, const char *imageSetName, const char *imageSetDesc, const ConstPixelBufferAccess &reference,
85     const ConstPixelBufferAccess &result, const UVec4 &threshold, const tcu::IVec3 &maxPositionDeviation,
86     bool acceptOutOfBoundsAsAnyValue, int maxAllowedFailingPixels, CompareLogMode logMode);
87 bool dsThresholdCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
88                         const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
89                         const float threshold, CompareLogMode logMode);
90 int measurePixelDiffAccuracy(TestLog &log, const char *imageSetName, const char *imageSetDesc,
91                              const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
92                              int bestScoreDiff, int worstScoreDiff, CompareLogMode logMode);
93 bool bilinearCompare(TestLog &log, const char *imageSetName, const char *imageSetDesc,
94                      const ConstPixelBufferAccess &reference, const ConstPixelBufferAccess &result,
95                      const RGBA threshold, CompareLogMode logMode);
96 
97 } // namespace tcu
98 
99 #endif // _TCUIMAGECOMPARE_HPP
100