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