1 #ifndef _TCUASTCUTIL_HPP
2 #define _TCUASTCUTIL_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program Tester Core
5  * ----------------------------------------
6  *
7  * Copyright 2016 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 ASTC Utilities.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "tcuDefs.hpp"
27 #include "tcuCompressedTexture.hpp"
28 
29 #include <vector>
30 
31 namespace tcu
32 {
33 namespace astc
34 {
35 
36 enum BlockTestType
37 {
38 	BLOCK_TEST_TYPE_VOID_EXTENT_LDR = 0,
39 	BLOCK_TEST_TYPE_VOID_EXTENT_HDR,
40 	BLOCK_TEST_TYPE_WEIGHT_GRID,
41 	BLOCK_TEST_TYPE_WEIGHT_ISE,
42 	BLOCK_TEST_TYPE_CEMS,
43 	BLOCK_TEST_TYPE_PARTITION_SEED,
44 	BLOCK_TEST_TYPE_ENDPOINT_VALUE_LDR,
45 	BLOCK_TEST_TYPE_ENDPOINT_VALUE_HDR_NO_15,
46 	BLOCK_TEST_TYPE_ENDPOINT_VALUE_HDR_15,
47 	BLOCK_TEST_TYPE_ENDPOINT_ISE,
48 	BLOCK_TEST_TYPE_CCS,
49 	BLOCK_TEST_TYPE_RANDOM,
50 
51 	BLOCK_TEST_TYPE_LAST
52 };
53 
54 enum
55 {
56 	BLOCK_SIZE_BYTES = 128/8,
57 };
58 
59 const char*		getBlockTestTypeName			(BlockTestType testType);
60 const char*		getBlockTestTypeDescription		(BlockTestType testType);
61 bool			isBlockTestTypeHDROnly			(BlockTestType testType);
62 Vec4			getBlockTestTypeColorScale		(BlockTestType testType);
63 Vec4			getBlockTestTypeColorBias		(BlockTestType testType);
64 
65 void			generateBlockCaseTestData		(std::vector<deUint8>& dst, CompressedTexFormat format, BlockTestType testType);
66 
67 void			generateRandomBlocks			(deUint8* dst, size_t numBlocks, CompressedTexFormat format, deUint32 seed);
68 void			generateRandomValidBlocks		(deUint8* dst, size_t numBlocks, CompressedTexFormat format, TexDecompressionParams::AstcMode mode, deUint32 seed);
69 
70 void			generateDummyVoidExtentBlocks	(deUint8* dst, size_t numBlocks);
71 void			generateDummyNormalBlocks		(deUint8* dst, size_t numBlocks, int blockWidth, int blockHeight);
72 
73 bool			isValidBlock					(const deUint8* data, CompressedTexFormat format, TexDecompressionParams::AstcMode mode);
74 
75 void			decompress						(const PixelBufferAccess& dst, const deUint8* data, CompressedTexFormat format, TexDecompressionParams::AstcMode mode);
76 
77 } // astc
78 } // tcu
79 
80 #endif // _TCUASTCUTIL_HPP
81