1 // SPDX-License-Identifier: Apache-2.0
2 // ----------------------------------------------------------------------------
3 // Copyright 2011-2020 Arm Limited
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 // use this file except in compliance with the License. You may obtain a copy
7 // of the License at:
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 // License for the specific language governing permissions and limitations
15 // under the License.
16 // ----------------------------------------------------------------------------
17 
18 /**
19  * @brief Data tables for quantization transfer.
20  */
21 
22 #include "astc_codec_internals.h"
23 
24 #define _ 0 // using _ to indicate an entry that will not be used.
25 
26 const quantization_and_transfer_table quant_and_xfer_tables[12] = {
27 	// quantization method 0, range 0..1
28 	{
29 		{0, 64},
30 	},
31 	// quantization method 1, range 0..2
32 	{
33 		{0, 32, 64},
34 	},
35 	// quantization method 2, range 0..3
36 	{
37 		{0, 21, 43, 64},
38 	},
39 	// quantization method 3, range 0..4
40 	{
41 		{0, 16, 32, 48, 64},
42 	},
43 	// quantization method 4, range 0..5
44 	{
45 		{0, 64, 12, 52, 25, 39},
46 	},
47 	// quantization method 5, range 0..7
48 	{
49 		{0, 9, 18, 27, 37, 46, 55, 64},
50 	},
51 	// quantization method 6, range 0..9
52 	{
53 		{0, 64, 7, 57, 14, 50, 21, 43, 28, 36},
54 	},
55 	// quantization method 7, range 0..11
56 	{
57 		{0, 64, 17, 47, 5, 59, 23, 41, 11, 53, 28, 36},
58 	},
59 	// quantization method 8, range 0..15
60 	{
61 		{0, 4, 8, 12, 17, 21, 25, 29, 35, 39, 43, 47, 52, 56, 60, 64},
62 	},
63 	// quantization method 9, range 0..19
64 	{
65 		{0, 64, 16, 48, 3, 61, 19, 45, 6, 58, 23, 41, 9, 55, 26, 38, 13, 51,
66 		 29, 35},
67 	},
68 	// quantization method 10, range 0..23
69 	{
70 		{0, 64, 8, 56, 16, 48, 24, 40, 2, 62, 11, 53, 19, 45, 27, 37, 5, 59,
71 		 13, 51, 22, 42, 30, 34},
72 	},
73 	// quantization method 11, range 0..31
74 	{
75 		{0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 34, 36, 38,
76 		 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64},
77 	}
78 };
79