1 | /* |
2 | Convection Texture Tools |
3 | Copyright (c) 2018-2019 Eric Lasota |
4 | |
5 | Permission is hereby granted, free of charge, to any person obtaining |
6 | a copy of this software and associated documentation files (the |
7 | "Software"), to deal in the Software without restriction, including |
8 | without limitation the rights to use, copy, modify, merge, publish, |
9 | distribute, sublicense, and/or sell copies of the Software, and to |
10 | permit persons to whom the Software is furnished to do so, subject |
11 | to the following conditions: |
12 | |
13 | The above copyright notice and this permission notice shall be included |
14 | in all copies or substantial portions of the Software. |
15 | |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | |
24 | ------------------------------------------------------------------------------------- |
25 | |
26 | Portions based on DirectX Texture Library (DirectXTex) |
27 | |
28 | Copyright (c) Microsoft Corporation. All rights reserved. |
29 | Licensed under the MIT License. |
30 | |
31 | http://go.microsoft.com/fwlink/?LinkId=248926 |
32 | */ |
33 | #include "ConvectionKernels_Config.h" |
34 | |
35 | #if !defined(CVTT_SINGLE_FILE) || defined(CVTT_SINGLE_FILE_IMPL) |
36 | |
37 | #include "ConvectionKernels_BC6H_IO.h" |
38 | |
39 | namespace cvtt |
40 | { |
41 | namespace BC6H_IO |
42 | { |
43 | void WriteMode0(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
44 | { |
45 | encoded[0] = (m & 0x3u) | ((gy >> 2) & 0x4u) | ((by >> 1) & 0x8u) | (bz & 0x10u) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
46 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0xf8u) | ((gz << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x3e000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0xf800000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
47 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x3eu) | ((bz << 4) & 0x40u) | ((rz << 7) & 0xf80u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
48 | } |
49 | |
50 | void WriteMode1(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
51 | { |
52 | encoded[0] = (m & 0x3u) | ((gy >> 3) & 0x4u) | ((gz >> 1) & 0x18u) | ((rw << 5) & 0xfe0u) | ((bz << 12) & 0x3000u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0x3f8000u) | ((by << 17) & 0x400000u) | ((bz << 21) & 0x800000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0xfe000000u); |
53 | encoded[1] = ((bz >> 3) & 0x1u) | ((bz >> 4) & 0x2u) | ((bz >> 2) & 0x4u) | ((rx << 3) & 0x1f8u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x7e000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0x1f800000u) | ((by << 29) & 0xe0000000u); |
54 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x7eu) | ((rz << 7) & 0x1f80u) | ((d << 13) & 0x3e000u); |
55 | } |
56 | |
57 | void WriteMode2(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
58 | { |
59 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
60 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0xf8u) | ((rw >> 2) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x1e000u) | ((gw << 7) & 0x20000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0x7800000u) | ((bw << 17) & 0x8000000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
61 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x3eu) | ((bz << 4) & 0x40u) | ((rz << 7) & 0xf80u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
62 | } |
63 | |
64 | void WriteMode3(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
65 | { |
66 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
67 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0x78u) | ((rw >> 3) & 0x80u) | ((gz << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x3e000u) | ((gw << 8) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0x7800000u) | ((bw << 17) & 0x8000000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
68 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x1eu) | ((bz << 5) & 0x20u) | ((bz << 4) & 0x40u) | ((rz << 7) & 0x780u) | ((gy << 7) & 0x800u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
69 | } |
70 | |
71 | void WriteMode4(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
72 | { |
73 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
74 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0x78u) | ((rw >> 3) & 0x80u) | ((by << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x1e000u) | ((gw << 7) & 0x20000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0xf800000u) | ((bw << 18) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
75 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x1eu) | ((bz << 4) & 0x60u) | ((rz << 7) & 0x780u) | ((bz << 7) & 0x800u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
76 | } |
77 | |
78 | void WriteMode5(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
79 | { |
80 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x3fe0u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0xff8000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0xfe000000u); |
81 | encoded[1] = ((bw >> 7) & 0x3u) | ((bz >> 2) & 0x4u) | ((rx << 3) & 0xf8u) | ((gz << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x3e000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0xf800000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
82 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x3eu) | ((bz << 4) & 0x40u) | ((rz << 7) & 0xf80u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
83 | } |
84 | |
85 | void WriteMode6(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
86 | { |
87 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x1fe0u) | ((gz << 9) & 0x2000u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0x7f8000u) | ((bz << 21) & 0x800000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0xfe000000u); |
88 | encoded[1] = ((bw >> 7) & 0x1u) | ((bz >> 2) & 0x6u) | ((rx << 3) & 0x1f8u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x3e000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0xf800000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
89 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x7eu) | ((rz << 7) & 0x1f80u) | ((d << 13) & 0x3e000u); |
90 | } |
91 | |
92 | void WriteMode7(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
93 | { |
94 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x1fe0u) | ((bz << 13) & 0x2000u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0x7f8000u) | ((gy << 18) & 0x800000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0xfe000000u); |
95 | encoded[1] = ((bw >> 7) & 0x1u) | ((gz >> 4) & 0x2u) | ((bz >> 2) & 0x4u) | ((rx << 3) & 0xf8u) | ((gz << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x7e000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0xf800000u) | ((bz << 27) & 0x10000000u) | ((by << 29) & 0xe0000000u); |
96 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x3eu) | ((bz << 4) & 0x40u) | ((rz << 7) & 0xf80u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
97 | } |
98 | |
99 | void WriteMode8(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
100 | { |
101 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x1fe0u) | ((bz << 12) & 0x2000u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0x7f8000u) | ((by << 18) & 0x800000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0xfe000000u); |
102 | encoded[1] = ((bw >> 7) & 0x1u) | ((bz >> 4) & 0x2u) | ((bz >> 2) & 0x4u) | ((rx << 3) & 0xf8u) | ((gz << 4) & 0x100u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x3e000u) | ((bz << 18) & 0x40000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0x1f800000u) | ((by << 29) & 0xe0000000u); |
103 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x3eu) | ((bz << 4) & 0x40u) | ((rz << 7) & 0xf80u) | ((bz << 9) & 0x1000u) | ((d << 13) & 0x3e000u); |
104 | } |
105 | |
106 | void WriteMode9(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
107 | { |
108 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7e0u) | ((gz << 7) & 0x800u) | ((bz << 12) & 0x3000u) | ((by << 10) & 0x4000u) | ((gw << 15) & 0x1f8000u) | ((gy << 16) & 0x200000u) | ((by << 17) & 0x400000u) | ((bz << 21) & 0x800000u) | ((gy << 20) & 0x1000000u) | ((bw << 25) & 0x7e000000u) | ((gz << 26) & 0x80000000u); |
109 | encoded[1] = ((bz >> 3) & 0x1u) | ((bz >> 4) & 0x2u) | ((bz >> 2) & 0x4u) | ((rx << 3) & 0x1f8u) | ((gy << 9) & 0x1e00u) | ((gx << 13) & 0x7e000u) | ((gz << 19) & 0x780000u) | ((bx << 23) & 0x1f800000u) | ((by << 29) & 0xe0000000u); |
110 | encoded[2] = ((by >> 3) & 0x1u) | ((ry << 1) & 0x7eu) | ((rz << 7) & 0x1f80u) | ((d << 13) & 0x3e000u); |
111 | } |
112 | |
113 | void WriteMode10(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
114 | { |
115 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
116 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0x1ff8u) | ((gx << 13) & 0x7fe000u) | ((bx << 23) & 0xff800000u); |
117 | encoded[2] = ((bx >> 9) & 0x1u); |
118 | } |
119 | |
120 | void WriteMode11(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
121 | { |
122 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
123 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0xff8u) | ((rw << 2) & 0x1000u) | ((gx << 13) & 0x3fe000u) | ((gw << 12) & 0x400000u) | ((bx << 23) & 0xff800000u); |
124 | encoded[2] = ((bw >> 10) & 0x1u); |
125 | } |
126 | |
127 | void WriteMode12(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
128 | { |
129 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
130 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0x7f8u) | (rw & 0x800u) | ((rw << 2) & 0x1000u) | ((gx << 13) & 0x1fe000u) | ((gw << 10) & 0x200000u) | ((gw << 12) & 0x400000u) | ((bx << 23) & 0x7f800000u) | ((bw << 20) & 0x80000000u); |
131 | encoded[2] = ((bw >> 10) & 0x1u); |
132 | } |
133 | |
134 | void WriteMode13(uint32_t *encoded, uint16_t m, uint16_t d, uint16_t rw, uint16_t rx, uint16_t ry, uint16_t rz, uint16_t gw, uint16_t gx, uint16_t gy, uint16_t gz, uint16_t bw, uint16_t bx, uint16_t by, uint16_t bz) |
135 | { |
136 | encoded[0] = (m & 0x1fu) | ((rw << 5) & 0x7fe0u) | ((gw << 15) & 0x1ff8000u) | ((bw << 25) & 0xfe000000u); |
137 | encoded[1] = ((bw >> 7) & 0x7u) | ((rx << 3) & 0x78u) | ((rw >> 8) & 0x80u) | ((rw >> 6) & 0x100u) | ((rw >> 4) & 0x200u) | ((rw >> 2) & 0x400u) | (rw & 0x800u) | ((rw << 2) & 0x1000u) | ((gx << 13) & 0x1e000u) | ((gw << 2) & 0x20000u) | ((gw << 4) & 0x40000u) | ((gw << 6) & 0x80000u) | ((gw << 8) & 0x100000u) | ((gw << 10) & 0x200000u) | ((gw << 12) & 0x400000u) | ((bx << 23) & 0x7800000u) | ((bw << 12) & 0x8000000u) | ((bw << 14) & 0x10000000u) | ((bw << 16) & 0x20000000u) | ((bw << 18) & 0x40000000u) | ((bw << 20) & 0x80000000u); |
138 | encoded[2] = ((bw >> 10) & 0x1u); |
139 | } |
140 | |
141 | void ReadMode0(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
142 | { |
143 | uint16_t d = 0; |
144 | uint16_t rw = 0; |
145 | uint16_t rx = 0; |
146 | uint16_t ry = 0; |
147 | uint16_t rz = 0; |
148 | uint16_t gw = 0; |
149 | uint16_t gx = 0; |
150 | uint16_t gy = 0; |
151 | uint16_t gz = 0; |
152 | uint16_t bw = 0; |
153 | uint16_t bx = 0; |
154 | uint16_t by = 0; |
155 | uint16_t bz = 0; |
156 | gy |= ((encoded[0] << 2) & 0x10u); |
157 | by |= ((encoded[0] << 1) & 0x10u); |
158 | bz |= (encoded[0] & 0x10u); |
159 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
160 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
161 | bw |= ((encoded[0] >> 25) & 0x7fu); |
162 | bw |= ((encoded[1] << 7) & 0x380u); |
163 | rx |= ((encoded[1] >> 3) & 0x1fu); |
164 | gz |= ((encoded[1] >> 4) & 0x10u); |
165 | gy |= ((encoded[1] >> 9) & 0xfu); |
166 | gx |= ((encoded[1] >> 13) & 0x1fu); |
167 | bz |= ((encoded[1] >> 18) & 0x1u); |
168 | gz |= ((encoded[1] >> 19) & 0xfu); |
169 | bx |= ((encoded[1] >> 23) & 0x1fu); |
170 | bz |= ((encoded[1] >> 27) & 0x2u); |
171 | by |= ((encoded[1] >> 29) & 0x7u); |
172 | by |= ((encoded[2] << 3) & 0x8u); |
173 | ry |= ((encoded[2] >> 1) & 0x1fu); |
174 | bz |= ((encoded[2] >> 4) & 0x4u); |
175 | rz |= ((encoded[2] >> 7) & 0x1fu); |
176 | bz |= ((encoded[2] >> 9) & 0x8u); |
177 | d |= ((encoded[2] >> 13) & 0x1fu); |
178 | outD = d; |
179 | outRW = rw; |
180 | outRX = rx; |
181 | outRY = ry; |
182 | outRZ = rz; |
183 | outGW = gw; |
184 | outGX = gx; |
185 | outGY = gy; |
186 | outGZ = gz; |
187 | outBW = bw; |
188 | outBX = bx; |
189 | outBY = by; |
190 | outBZ = bz; |
191 | } |
192 | |
193 | void ReadMode1(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
194 | { |
195 | uint16_t d = 0; |
196 | uint16_t rw = 0; |
197 | uint16_t rx = 0; |
198 | uint16_t ry = 0; |
199 | uint16_t rz = 0; |
200 | uint16_t gw = 0; |
201 | uint16_t gx = 0; |
202 | uint16_t gy = 0; |
203 | uint16_t gz = 0; |
204 | uint16_t bw = 0; |
205 | uint16_t bx = 0; |
206 | uint16_t by = 0; |
207 | uint16_t bz = 0; |
208 | gy |= ((encoded[0] << 3) & 0x20u); |
209 | gz |= ((encoded[0] << 1) & 0x30u); |
210 | rw |= ((encoded[0] >> 5) & 0x7fu); |
211 | bz |= ((encoded[0] >> 12) & 0x3u); |
212 | by |= ((encoded[0] >> 10) & 0x10u); |
213 | gw |= ((encoded[0] >> 15) & 0x7fu); |
214 | by |= ((encoded[0] >> 17) & 0x20u); |
215 | bz |= ((encoded[0] >> 21) & 0x4u); |
216 | gy |= ((encoded[0] >> 20) & 0x10u); |
217 | bw |= ((encoded[0] >> 25) & 0x7fu); |
218 | bz |= ((encoded[1] << 3) & 0x8u); |
219 | bz |= ((encoded[1] << 4) & 0x20u); |
220 | bz |= ((encoded[1] << 2) & 0x10u); |
221 | rx |= ((encoded[1] >> 3) & 0x3fu); |
222 | gy |= ((encoded[1] >> 9) & 0xfu); |
223 | gx |= ((encoded[1] >> 13) & 0x3fu); |
224 | gz |= ((encoded[1] >> 19) & 0xfu); |
225 | bx |= ((encoded[1] >> 23) & 0x3fu); |
226 | by |= ((encoded[1] >> 29) & 0x7u); |
227 | by |= ((encoded[2] << 3) & 0x8u); |
228 | ry |= ((encoded[2] >> 1) & 0x3fu); |
229 | rz |= ((encoded[2] >> 7) & 0x3fu); |
230 | d |= ((encoded[2] >> 13) & 0x1fu); |
231 | outD = d; |
232 | outRW = rw; |
233 | outRX = rx; |
234 | outRY = ry; |
235 | outRZ = rz; |
236 | outGW = gw; |
237 | outGX = gx; |
238 | outGY = gy; |
239 | outGZ = gz; |
240 | outBW = bw; |
241 | outBX = bx; |
242 | outBY = by; |
243 | outBZ = bz; |
244 | } |
245 | |
246 | void ReadMode2(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
247 | { |
248 | uint16_t d = 0; |
249 | uint16_t rw = 0; |
250 | uint16_t rx = 0; |
251 | uint16_t ry = 0; |
252 | uint16_t rz = 0; |
253 | uint16_t gw = 0; |
254 | uint16_t gx = 0; |
255 | uint16_t gy = 0; |
256 | uint16_t gz = 0; |
257 | uint16_t bw = 0; |
258 | uint16_t bx = 0; |
259 | uint16_t by = 0; |
260 | uint16_t bz = 0; |
261 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
262 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
263 | bw |= ((encoded[0] >> 25) & 0x7fu); |
264 | bw |= ((encoded[1] << 7) & 0x380u); |
265 | rx |= ((encoded[1] >> 3) & 0x1fu); |
266 | rw |= ((encoded[1] << 2) & 0x400u); |
267 | gy |= ((encoded[1] >> 9) & 0xfu); |
268 | gx |= ((encoded[1] >> 13) & 0xfu); |
269 | gw |= ((encoded[1] >> 7) & 0x400u); |
270 | bz |= ((encoded[1] >> 18) & 0x1u); |
271 | gz |= ((encoded[1] >> 19) & 0xfu); |
272 | bx |= ((encoded[1] >> 23) & 0xfu); |
273 | bw |= ((encoded[1] >> 17) & 0x400u); |
274 | bz |= ((encoded[1] >> 27) & 0x2u); |
275 | by |= ((encoded[1] >> 29) & 0x7u); |
276 | by |= ((encoded[2] << 3) & 0x8u); |
277 | ry |= ((encoded[2] >> 1) & 0x1fu); |
278 | bz |= ((encoded[2] >> 4) & 0x4u); |
279 | rz |= ((encoded[2] >> 7) & 0x1fu); |
280 | bz |= ((encoded[2] >> 9) & 0x8u); |
281 | d |= ((encoded[2] >> 13) & 0x1fu); |
282 | outD = d; |
283 | outRW = rw; |
284 | outRX = rx; |
285 | outRY = ry; |
286 | outRZ = rz; |
287 | outGW = gw; |
288 | outGX = gx; |
289 | outGY = gy; |
290 | outGZ = gz; |
291 | outBW = bw; |
292 | outBX = bx; |
293 | outBY = by; |
294 | outBZ = bz; |
295 | } |
296 | |
297 | void ReadMode3(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
298 | { |
299 | uint16_t d = 0; |
300 | uint16_t rw = 0; |
301 | uint16_t rx = 0; |
302 | uint16_t ry = 0; |
303 | uint16_t rz = 0; |
304 | uint16_t gw = 0; |
305 | uint16_t gx = 0; |
306 | uint16_t gy = 0; |
307 | uint16_t gz = 0; |
308 | uint16_t bw = 0; |
309 | uint16_t bx = 0; |
310 | uint16_t by = 0; |
311 | uint16_t bz = 0; |
312 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
313 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
314 | bw |= ((encoded[0] >> 25) & 0x7fu); |
315 | bw |= ((encoded[1] << 7) & 0x380u); |
316 | rx |= ((encoded[1] >> 3) & 0xfu); |
317 | rw |= ((encoded[1] << 3) & 0x400u); |
318 | gz |= ((encoded[1] >> 4) & 0x10u); |
319 | gy |= ((encoded[1] >> 9) & 0xfu); |
320 | gx |= ((encoded[1] >> 13) & 0x1fu); |
321 | gw |= ((encoded[1] >> 8) & 0x400u); |
322 | gz |= ((encoded[1] >> 19) & 0xfu); |
323 | bx |= ((encoded[1] >> 23) & 0xfu); |
324 | bw |= ((encoded[1] >> 17) & 0x400u); |
325 | bz |= ((encoded[1] >> 27) & 0x2u); |
326 | by |= ((encoded[1] >> 29) & 0x7u); |
327 | by |= ((encoded[2] << 3) & 0x8u); |
328 | ry |= ((encoded[2] >> 1) & 0xfu); |
329 | bz |= ((encoded[2] >> 5) & 0x1u); |
330 | bz |= ((encoded[2] >> 4) & 0x4u); |
331 | rz |= ((encoded[2] >> 7) & 0xfu); |
332 | gy |= ((encoded[2] >> 7) & 0x10u); |
333 | bz |= ((encoded[2] >> 9) & 0x8u); |
334 | d |= ((encoded[2] >> 13) & 0x1fu); |
335 | outD = d; |
336 | outRW = rw; |
337 | outRX = rx; |
338 | outRY = ry; |
339 | outRZ = rz; |
340 | outGW = gw; |
341 | outGX = gx; |
342 | outGY = gy; |
343 | outGZ = gz; |
344 | outBW = bw; |
345 | outBX = bx; |
346 | outBY = by; |
347 | outBZ = bz; |
348 | } |
349 | |
350 | void ReadMode4(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
351 | { |
352 | uint16_t d = 0; |
353 | uint16_t rw = 0; |
354 | uint16_t rx = 0; |
355 | uint16_t ry = 0; |
356 | uint16_t rz = 0; |
357 | uint16_t gw = 0; |
358 | uint16_t gx = 0; |
359 | uint16_t gy = 0; |
360 | uint16_t gz = 0; |
361 | uint16_t bw = 0; |
362 | uint16_t bx = 0; |
363 | uint16_t by = 0; |
364 | uint16_t bz = 0; |
365 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
366 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
367 | bw |= ((encoded[0] >> 25) & 0x7fu); |
368 | bw |= ((encoded[1] << 7) & 0x380u); |
369 | rx |= ((encoded[1] >> 3) & 0xfu); |
370 | rw |= ((encoded[1] << 3) & 0x400u); |
371 | by |= ((encoded[1] >> 4) & 0x10u); |
372 | gy |= ((encoded[1] >> 9) & 0xfu); |
373 | gx |= ((encoded[1] >> 13) & 0xfu); |
374 | gw |= ((encoded[1] >> 7) & 0x400u); |
375 | bz |= ((encoded[1] >> 18) & 0x1u); |
376 | gz |= ((encoded[1] >> 19) & 0xfu); |
377 | bx |= ((encoded[1] >> 23) & 0x1fu); |
378 | bw |= ((encoded[1] >> 18) & 0x400u); |
379 | by |= ((encoded[1] >> 29) & 0x7u); |
380 | by |= ((encoded[2] << 3) & 0x8u); |
381 | ry |= ((encoded[2] >> 1) & 0xfu); |
382 | bz |= ((encoded[2] >> 4) & 0x6u); |
383 | rz |= ((encoded[2] >> 7) & 0xfu); |
384 | bz |= ((encoded[2] >> 7) & 0x10u); |
385 | bz |= ((encoded[2] >> 9) & 0x8u); |
386 | d |= ((encoded[2] >> 13) & 0x1fu); |
387 | outD = d; |
388 | outRW = rw; |
389 | outRX = rx; |
390 | outRY = ry; |
391 | outRZ = rz; |
392 | outGW = gw; |
393 | outGX = gx; |
394 | outGY = gy; |
395 | outGZ = gz; |
396 | outBW = bw; |
397 | outBX = bx; |
398 | outBY = by; |
399 | outBZ = bz; |
400 | } |
401 | |
402 | void ReadMode5(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
403 | { |
404 | uint16_t d = 0; |
405 | uint16_t rw = 0; |
406 | uint16_t rx = 0; |
407 | uint16_t ry = 0; |
408 | uint16_t rz = 0; |
409 | uint16_t gw = 0; |
410 | uint16_t gx = 0; |
411 | uint16_t gy = 0; |
412 | uint16_t gz = 0; |
413 | uint16_t bw = 0; |
414 | uint16_t bx = 0; |
415 | uint16_t by = 0; |
416 | uint16_t bz = 0; |
417 | rw |= ((encoded[0] >> 5) & 0x1ffu); |
418 | by |= ((encoded[0] >> 10) & 0x10u); |
419 | gw |= ((encoded[0] >> 15) & 0x1ffu); |
420 | gy |= ((encoded[0] >> 20) & 0x10u); |
421 | bw |= ((encoded[0] >> 25) & 0x7fu); |
422 | bw |= ((encoded[1] << 7) & 0x180u); |
423 | bz |= ((encoded[1] << 2) & 0x10u); |
424 | rx |= ((encoded[1] >> 3) & 0x1fu); |
425 | gz |= ((encoded[1] >> 4) & 0x10u); |
426 | gy |= ((encoded[1] >> 9) & 0xfu); |
427 | gx |= ((encoded[1] >> 13) & 0x1fu); |
428 | bz |= ((encoded[1] >> 18) & 0x1u); |
429 | gz |= ((encoded[1] >> 19) & 0xfu); |
430 | bx |= ((encoded[1] >> 23) & 0x1fu); |
431 | bz |= ((encoded[1] >> 27) & 0x2u); |
432 | by |= ((encoded[1] >> 29) & 0x7u); |
433 | by |= ((encoded[2] << 3) & 0x8u); |
434 | ry |= ((encoded[2] >> 1) & 0x1fu); |
435 | bz |= ((encoded[2] >> 4) & 0x4u); |
436 | rz |= ((encoded[2] >> 7) & 0x1fu); |
437 | bz |= ((encoded[2] >> 9) & 0x8u); |
438 | d |= ((encoded[2] >> 13) & 0x1fu); |
439 | outD = d; |
440 | outRW = rw; |
441 | outRX = rx; |
442 | outRY = ry; |
443 | outRZ = rz; |
444 | outGW = gw; |
445 | outGX = gx; |
446 | outGY = gy; |
447 | outGZ = gz; |
448 | outBW = bw; |
449 | outBX = bx; |
450 | outBY = by; |
451 | outBZ = bz; |
452 | } |
453 | |
454 | void ReadMode6(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
455 | { |
456 | uint16_t d = 0; |
457 | uint16_t rw = 0; |
458 | uint16_t rx = 0; |
459 | uint16_t ry = 0; |
460 | uint16_t rz = 0; |
461 | uint16_t gw = 0; |
462 | uint16_t gx = 0; |
463 | uint16_t gy = 0; |
464 | uint16_t gz = 0; |
465 | uint16_t bw = 0; |
466 | uint16_t bx = 0; |
467 | uint16_t by = 0; |
468 | uint16_t bz = 0; |
469 | rw |= ((encoded[0] >> 5) & 0xffu); |
470 | gz |= ((encoded[0] >> 9) & 0x10u); |
471 | by |= ((encoded[0] >> 10) & 0x10u); |
472 | gw |= ((encoded[0] >> 15) & 0xffu); |
473 | bz |= ((encoded[0] >> 21) & 0x4u); |
474 | gy |= ((encoded[0] >> 20) & 0x10u); |
475 | bw |= ((encoded[0] >> 25) & 0x7fu); |
476 | bw |= ((encoded[1] << 7) & 0x80u); |
477 | bz |= ((encoded[1] << 2) & 0x18u); |
478 | rx |= ((encoded[1] >> 3) & 0x3fu); |
479 | gy |= ((encoded[1] >> 9) & 0xfu); |
480 | gx |= ((encoded[1] >> 13) & 0x1fu); |
481 | bz |= ((encoded[1] >> 18) & 0x1u); |
482 | gz |= ((encoded[1] >> 19) & 0xfu); |
483 | bx |= ((encoded[1] >> 23) & 0x1fu); |
484 | bz |= ((encoded[1] >> 27) & 0x2u); |
485 | by |= ((encoded[1] >> 29) & 0x7u); |
486 | by |= ((encoded[2] << 3) & 0x8u); |
487 | ry |= ((encoded[2] >> 1) & 0x3fu); |
488 | rz |= ((encoded[2] >> 7) & 0x3fu); |
489 | d |= ((encoded[2] >> 13) & 0x1fu); |
490 | outD = d; |
491 | outRW = rw; |
492 | outRX = rx; |
493 | outRY = ry; |
494 | outRZ = rz; |
495 | outGW = gw; |
496 | outGX = gx; |
497 | outGY = gy; |
498 | outGZ = gz; |
499 | outBW = bw; |
500 | outBX = bx; |
501 | outBY = by; |
502 | outBZ = bz; |
503 | } |
504 | |
505 | void ReadMode7(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
506 | { |
507 | uint16_t d = 0; |
508 | uint16_t rw = 0; |
509 | uint16_t rx = 0; |
510 | uint16_t ry = 0; |
511 | uint16_t rz = 0; |
512 | uint16_t gw = 0; |
513 | uint16_t gx = 0; |
514 | uint16_t gy = 0; |
515 | uint16_t gz = 0; |
516 | uint16_t bw = 0; |
517 | uint16_t bx = 0; |
518 | uint16_t by = 0; |
519 | uint16_t bz = 0; |
520 | rw |= ((encoded[0] >> 5) & 0xffu); |
521 | bz |= ((encoded[0] >> 13) & 0x1u); |
522 | by |= ((encoded[0] >> 10) & 0x10u); |
523 | gw |= ((encoded[0] >> 15) & 0xffu); |
524 | gy |= ((encoded[0] >> 18) & 0x20u); |
525 | gy |= ((encoded[0] >> 20) & 0x10u); |
526 | bw |= ((encoded[0] >> 25) & 0x7fu); |
527 | bw |= ((encoded[1] << 7) & 0x80u); |
528 | gz |= ((encoded[1] << 4) & 0x20u); |
529 | bz |= ((encoded[1] << 2) & 0x10u); |
530 | rx |= ((encoded[1] >> 3) & 0x1fu); |
531 | gz |= ((encoded[1] >> 4) & 0x10u); |
532 | gy |= ((encoded[1] >> 9) & 0xfu); |
533 | gx |= ((encoded[1] >> 13) & 0x3fu); |
534 | gz |= ((encoded[1] >> 19) & 0xfu); |
535 | bx |= ((encoded[1] >> 23) & 0x1fu); |
536 | bz |= ((encoded[1] >> 27) & 0x2u); |
537 | by |= ((encoded[1] >> 29) & 0x7u); |
538 | by |= ((encoded[2] << 3) & 0x8u); |
539 | ry |= ((encoded[2] >> 1) & 0x1fu); |
540 | bz |= ((encoded[2] >> 4) & 0x4u); |
541 | rz |= ((encoded[2] >> 7) & 0x1fu); |
542 | bz |= ((encoded[2] >> 9) & 0x8u); |
543 | d |= ((encoded[2] >> 13) & 0x1fu); |
544 | outD = d; |
545 | outRW = rw; |
546 | outRX = rx; |
547 | outRY = ry; |
548 | outRZ = rz; |
549 | outGW = gw; |
550 | outGX = gx; |
551 | outGY = gy; |
552 | outGZ = gz; |
553 | outBW = bw; |
554 | outBX = bx; |
555 | outBY = by; |
556 | outBZ = bz; |
557 | } |
558 | |
559 | void ReadMode8(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
560 | { |
561 | uint16_t d = 0; |
562 | uint16_t rw = 0; |
563 | uint16_t rx = 0; |
564 | uint16_t ry = 0; |
565 | uint16_t rz = 0; |
566 | uint16_t gw = 0; |
567 | uint16_t gx = 0; |
568 | uint16_t gy = 0; |
569 | uint16_t gz = 0; |
570 | uint16_t bw = 0; |
571 | uint16_t bx = 0; |
572 | uint16_t by = 0; |
573 | uint16_t bz = 0; |
574 | rw |= ((encoded[0] >> 5) & 0xffu); |
575 | bz |= ((encoded[0] >> 12) & 0x2u); |
576 | by |= ((encoded[0] >> 10) & 0x10u); |
577 | gw |= ((encoded[0] >> 15) & 0xffu); |
578 | by |= ((encoded[0] >> 18) & 0x20u); |
579 | gy |= ((encoded[0] >> 20) & 0x10u); |
580 | bw |= ((encoded[0] >> 25) & 0x7fu); |
581 | bw |= ((encoded[1] << 7) & 0x80u); |
582 | bz |= ((encoded[1] << 4) & 0x20u); |
583 | bz |= ((encoded[1] << 2) & 0x10u); |
584 | rx |= ((encoded[1] >> 3) & 0x1fu); |
585 | gz |= ((encoded[1] >> 4) & 0x10u); |
586 | gy |= ((encoded[1] >> 9) & 0xfu); |
587 | gx |= ((encoded[1] >> 13) & 0x1fu); |
588 | bz |= ((encoded[1] >> 18) & 0x1u); |
589 | gz |= ((encoded[1] >> 19) & 0xfu); |
590 | bx |= ((encoded[1] >> 23) & 0x3fu); |
591 | by |= ((encoded[1] >> 29) & 0x7u); |
592 | by |= ((encoded[2] << 3) & 0x8u); |
593 | ry |= ((encoded[2] >> 1) & 0x1fu); |
594 | bz |= ((encoded[2] >> 4) & 0x4u); |
595 | rz |= ((encoded[2] >> 7) & 0x1fu); |
596 | bz |= ((encoded[2] >> 9) & 0x8u); |
597 | d |= ((encoded[2] >> 13) & 0x1fu); |
598 | outD = d; |
599 | outRW = rw; |
600 | outRX = rx; |
601 | outRY = ry; |
602 | outRZ = rz; |
603 | outGW = gw; |
604 | outGX = gx; |
605 | outGY = gy; |
606 | outGZ = gz; |
607 | outBW = bw; |
608 | outBX = bx; |
609 | outBY = by; |
610 | outBZ = bz; |
611 | } |
612 | |
613 | void ReadMode9(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
614 | { |
615 | uint16_t d = 0; |
616 | uint16_t rw = 0; |
617 | uint16_t rx = 0; |
618 | uint16_t ry = 0; |
619 | uint16_t rz = 0; |
620 | uint16_t gw = 0; |
621 | uint16_t gx = 0; |
622 | uint16_t gy = 0; |
623 | uint16_t gz = 0; |
624 | uint16_t bw = 0; |
625 | uint16_t bx = 0; |
626 | uint16_t by = 0; |
627 | uint16_t bz = 0; |
628 | rw |= ((encoded[0] >> 5) & 0x3fu); |
629 | gz |= ((encoded[0] >> 7) & 0x10u); |
630 | bz |= ((encoded[0] >> 12) & 0x3u); |
631 | by |= ((encoded[0] >> 10) & 0x10u); |
632 | gw |= ((encoded[0] >> 15) & 0x3fu); |
633 | gy |= ((encoded[0] >> 16) & 0x20u); |
634 | by |= ((encoded[0] >> 17) & 0x20u); |
635 | bz |= ((encoded[0] >> 21) & 0x4u); |
636 | gy |= ((encoded[0] >> 20) & 0x10u); |
637 | bw |= ((encoded[0] >> 25) & 0x3fu); |
638 | gz |= ((encoded[0] >> 26) & 0x20u); |
639 | bz |= ((encoded[1] << 3) & 0x8u); |
640 | bz |= ((encoded[1] << 4) & 0x20u); |
641 | bz |= ((encoded[1] << 2) & 0x10u); |
642 | rx |= ((encoded[1] >> 3) & 0x3fu); |
643 | gy |= ((encoded[1] >> 9) & 0xfu); |
644 | gx |= ((encoded[1] >> 13) & 0x3fu); |
645 | gz |= ((encoded[1] >> 19) & 0xfu); |
646 | bx |= ((encoded[1] >> 23) & 0x3fu); |
647 | by |= ((encoded[1] >> 29) & 0x7u); |
648 | by |= ((encoded[2] << 3) & 0x8u); |
649 | ry |= ((encoded[2] >> 1) & 0x3fu); |
650 | rz |= ((encoded[2] >> 7) & 0x3fu); |
651 | d |= ((encoded[2] >> 13) & 0x1fu); |
652 | outD = d; |
653 | outRW = rw; |
654 | outRX = rx; |
655 | outRY = ry; |
656 | outRZ = rz; |
657 | outGW = gw; |
658 | outGX = gx; |
659 | outGY = gy; |
660 | outGZ = gz; |
661 | outBW = bw; |
662 | outBX = bx; |
663 | outBY = by; |
664 | outBZ = bz; |
665 | } |
666 | |
667 | void ReadMode10(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
668 | { |
669 | uint16_t d = 0; |
670 | uint16_t rw = 0; |
671 | uint16_t rx = 0; |
672 | uint16_t ry = 0; |
673 | uint16_t rz = 0; |
674 | uint16_t gw = 0; |
675 | uint16_t gx = 0; |
676 | uint16_t gy = 0; |
677 | uint16_t gz = 0; |
678 | uint16_t bw = 0; |
679 | uint16_t bx = 0; |
680 | uint16_t by = 0; |
681 | uint16_t bz = 0; |
682 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
683 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
684 | bw |= ((encoded[0] >> 25) & 0x7fu); |
685 | bw |= ((encoded[1] << 7) & 0x380u); |
686 | rx |= ((encoded[1] >> 3) & 0x3ffu); |
687 | gx |= ((encoded[1] >> 13) & 0x3ffu); |
688 | bx |= ((encoded[1] >> 23) & 0x1ffu); |
689 | bx |= ((encoded[2] << 9) & 0x200u); |
690 | outD = d; |
691 | outRW = rw; |
692 | outRX = rx; |
693 | outRY = ry; |
694 | outRZ = rz; |
695 | outGW = gw; |
696 | outGX = gx; |
697 | outGY = gy; |
698 | outGZ = gz; |
699 | outBW = bw; |
700 | outBX = bx; |
701 | outBY = by; |
702 | outBZ = bz; |
703 | } |
704 | |
705 | void ReadMode11(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
706 | { |
707 | uint16_t d = 0; |
708 | uint16_t rw = 0; |
709 | uint16_t rx = 0; |
710 | uint16_t ry = 0; |
711 | uint16_t rz = 0; |
712 | uint16_t gw = 0; |
713 | uint16_t gx = 0; |
714 | uint16_t gy = 0; |
715 | uint16_t gz = 0; |
716 | uint16_t bw = 0; |
717 | uint16_t bx = 0; |
718 | uint16_t by = 0; |
719 | uint16_t bz = 0; |
720 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
721 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
722 | bw |= ((encoded[0] >> 25) & 0x7fu); |
723 | bw |= ((encoded[1] << 7) & 0x380u); |
724 | rx |= ((encoded[1] >> 3) & 0x1ffu); |
725 | rw |= ((encoded[1] >> 2) & 0x400u); |
726 | gx |= ((encoded[1] >> 13) & 0x1ffu); |
727 | gw |= ((encoded[1] >> 12) & 0x400u); |
728 | bx |= ((encoded[1] >> 23) & 0x1ffu); |
729 | bw |= ((encoded[2] << 10) & 0x400u); |
730 | outD = d; |
731 | outRW = rw; |
732 | outRX = rx; |
733 | outRY = ry; |
734 | outRZ = rz; |
735 | outGW = gw; |
736 | outGX = gx; |
737 | outGY = gy; |
738 | outGZ = gz; |
739 | outBW = bw; |
740 | outBX = bx; |
741 | outBY = by; |
742 | outBZ = bz; |
743 | } |
744 | |
745 | void ReadMode12(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
746 | { |
747 | uint16_t d = 0; |
748 | uint16_t rw = 0; |
749 | uint16_t rx = 0; |
750 | uint16_t ry = 0; |
751 | uint16_t rz = 0; |
752 | uint16_t gw = 0; |
753 | uint16_t gx = 0; |
754 | uint16_t gy = 0; |
755 | uint16_t gz = 0; |
756 | uint16_t bw = 0; |
757 | uint16_t bx = 0; |
758 | uint16_t by = 0; |
759 | uint16_t bz = 0; |
760 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
761 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
762 | bw |= ((encoded[0] >> 25) & 0x7fu); |
763 | bw |= ((encoded[1] << 7) & 0x380u); |
764 | rx |= ((encoded[1] >> 3) & 0xffu); |
765 | rw |= (encoded[1] & 0x800u); |
766 | rw |= ((encoded[1] >> 2) & 0x400u); |
767 | gx |= ((encoded[1] >> 13) & 0xffu); |
768 | gw |= ((encoded[1] >> 10) & 0x800u); |
769 | gw |= ((encoded[1] >> 12) & 0x400u); |
770 | bx |= ((encoded[1] >> 23) & 0xffu); |
771 | bw |= ((encoded[1] >> 20) & 0x800u); |
772 | bw |= ((encoded[2] << 10) & 0x400u); |
773 | outD = d; |
774 | outRW = rw; |
775 | outRX = rx; |
776 | outRY = ry; |
777 | outRZ = rz; |
778 | outGW = gw; |
779 | outGX = gx; |
780 | outGY = gy; |
781 | outGZ = gz; |
782 | outBW = bw; |
783 | outBX = bx; |
784 | outBY = by; |
785 | outBZ = bz; |
786 | } |
787 | |
788 | void ReadMode13(const uint32_t *encoded, uint16_t &outD, uint16_t &outRW, uint16_t &outRX, uint16_t &outRY, uint16_t &outRZ, uint16_t &outGW, uint16_t &outGX, uint16_t &outGY, uint16_t &outGZ, uint16_t &outBW, uint16_t &outBX, uint16_t &outBY, uint16_t &outBZ) |
789 | { |
790 | uint16_t d = 0; |
791 | uint16_t rw = 0; |
792 | uint16_t rx = 0; |
793 | uint16_t ry = 0; |
794 | uint16_t rz = 0; |
795 | uint16_t gw = 0; |
796 | uint16_t gx = 0; |
797 | uint16_t gy = 0; |
798 | uint16_t gz = 0; |
799 | uint16_t bw = 0; |
800 | uint16_t bx = 0; |
801 | uint16_t by = 0; |
802 | uint16_t bz = 0; |
803 | rw |= ((encoded[0] >> 5) & 0x3ffu); |
804 | gw |= ((encoded[0] >> 15) & 0x3ffu); |
805 | bw |= ((encoded[0] >> 25) & 0x7fu); |
806 | bw |= ((encoded[1] << 7) & 0x380u); |
807 | rx |= ((encoded[1] >> 3) & 0xfu); |
808 | rw |= ((encoded[1] << 8) & 0x8000u); |
809 | rw |= ((encoded[1] << 6) & 0x4000u); |
810 | rw |= ((encoded[1] << 4) & 0x2000u); |
811 | rw |= ((encoded[1] << 2) & 0x1000u); |
812 | rw |= (encoded[1] & 0x800u); |
813 | rw |= ((encoded[1] >> 2) & 0x400u); |
814 | gx |= ((encoded[1] >> 13) & 0xfu); |
815 | gw |= ((encoded[1] >> 2) & 0x8000u); |
816 | gw |= ((encoded[1] >> 4) & 0x4000u); |
817 | gw |= ((encoded[1] >> 6) & 0x2000u); |
818 | gw |= ((encoded[1] >> 8) & 0x1000u); |
819 | gw |= ((encoded[1] >> 10) & 0x800u); |
820 | gw |= ((encoded[1] >> 12) & 0x400u); |
821 | bx |= ((encoded[1] >> 23) & 0xfu); |
822 | bw |= ((encoded[1] >> 12) & 0x8000u); |
823 | bw |= ((encoded[1] >> 14) & 0x4000u); |
824 | bw |= ((encoded[1] >> 16) & 0x2000u); |
825 | bw |= ((encoded[1] >> 18) & 0x1000u); |
826 | bw |= ((encoded[1] >> 20) & 0x800u); |
827 | bw |= ((encoded[2] << 10) & 0x400u); |
828 | outD = d; |
829 | outRW = rw; |
830 | outRX = rx; |
831 | outRY = ry; |
832 | outRZ = rz; |
833 | outGW = gw; |
834 | outGX = gx; |
835 | outGY = gy; |
836 | outGZ = gz; |
837 | outBW = bw; |
838 | outBX = bx; |
839 | outBY = by; |
840 | outBZ = bz; |
841 | } |
842 | |
843 | const ReadFunc_t g_readFuncs[14] = |
844 | { |
845 | ReadMode0, |
846 | ReadMode1, |
847 | ReadMode2, |
848 | ReadMode3, |
849 | ReadMode4, |
850 | ReadMode5, |
851 | ReadMode6, |
852 | ReadMode7, |
853 | ReadMode8, |
854 | ReadMode9, |
855 | ReadMode10, |
856 | ReadMode11, |
857 | ReadMode12, |
858 | ReadMode13 |
859 | }; |
860 | |
861 | const WriteFunc_t g_writeFuncs[14] = |
862 | { |
863 | WriteMode0, |
864 | WriteMode1, |
865 | WriteMode2, |
866 | WriteMode3, |
867 | WriteMode4, |
868 | WriteMode5, |
869 | WriteMode6, |
870 | WriteMode7, |
871 | WriteMode8, |
872 | WriteMode9, |
873 | WriteMode10, |
874 | WriteMode11, |
875 | WriteMode12, |
876 | WriteMode13 |
877 | }; |
878 | } |
879 | } |
880 | |
881 | #endif |
882 | |