lin
2025-08-14 dae8bad597b6607a449b32bf76c523423f7720ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef _TCUASTCUTIL_HPP
#define _TCUASTCUTIL_HPP
/*-------------------------------------------------------------------------
 * drawElements Quality Program Tester Core
 * ----------------------------------------
 *
 * Copyright 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *//*!
 * \file
 * \brief ASTC Utilities.
 *//*--------------------------------------------------------------------*/
 
#include "tcuDefs.hpp"
#include "tcuCompressedTexture.hpp"
 
#include <vector>
 
namespace tcu
{
namespace astc
{
 
enum BlockTestType
{
   BLOCK_TEST_TYPE_VOID_EXTENT_LDR = 0,
   BLOCK_TEST_TYPE_VOID_EXTENT_HDR,
   BLOCK_TEST_TYPE_WEIGHT_GRID,
   BLOCK_TEST_TYPE_WEIGHT_ISE,
   BLOCK_TEST_TYPE_CEMS,
   BLOCK_TEST_TYPE_PARTITION_SEED,
   BLOCK_TEST_TYPE_ENDPOINT_VALUE_LDR,
   BLOCK_TEST_TYPE_ENDPOINT_VALUE_HDR_NO_15,
   BLOCK_TEST_TYPE_ENDPOINT_VALUE_HDR_15,
   BLOCK_TEST_TYPE_ENDPOINT_ISE,
   BLOCK_TEST_TYPE_CCS,
   BLOCK_TEST_TYPE_RANDOM,
 
   BLOCK_TEST_TYPE_LAST
};
 
enum
{
   BLOCK_SIZE_BYTES = 128/8,
};
 
const char*        getBlockTestTypeName            (BlockTestType testType);
const char*        getBlockTestTypeDescription        (BlockTestType testType);
bool            isBlockTestTypeHDROnly            (BlockTestType testType);
Vec4            getBlockTestTypeColorScale        (BlockTestType testType);
Vec4            getBlockTestTypeColorBias        (BlockTestType testType);
 
void            generateBlockCaseTestData        (std::vector<deUint8>& dst, CompressedTexFormat format, BlockTestType testType);
 
void            generateRandomBlocks            (deUint8* dst, size_t numBlocks, CompressedTexFormat format, deUint32 seed);
void            generateRandomValidBlocks        (deUint8* dst, size_t numBlocks, CompressedTexFormat format, TexDecompressionParams::AstcMode mode, deUint32 seed);
 
void            generateDummyVoidExtentBlocks    (deUint8* dst, size_t numBlocks);
void            generateDummyNormalBlocks        (deUint8* dst, size_t numBlocks, int blockWidth, int blockHeight);
 
bool            isValidBlock                    (const deUint8* data, CompressedTexFormat format, TexDecompressionParams::AstcMode mode);
 
void            decompress                        (const PixelBufferAccess& dst, const deUint8* data, CompressedTexFormat format, TexDecompressionParams::AstcMode mode);
 
} // astc
} // tcu
 
#endif // _TCUASTCUTIL_HPP