MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / index_collapse

Function index_collapse

cmp_compressonatorlib/bc7/reconstruct.cpp:151–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void index_collapse // assymtric of x->n-x, but this does not matter below
152 (int index[], int numEntries)
153{
154#ifdef USE_DBGTRACE
155 DbgTrace(());
156#endif
157 int k;
158 int d, D;
159
160 int mi;
161 int Mi;
162
163 if (numEntries == 0)
164 return;
165
166 mi = Mi = index[0];
167
168 for (k = 0; k < numEntries; k++)
169 {
170 mi = mi < index[k] ? mi : index[k];
171 Mi = Mi > index[k] ? Mi : index[k];
172 }
173
174 D = 1;
175
176 for (d = 2; d <= Mi; d++)
177 {
178 for (k = 0; k < numEntries; k++)
179 if ((index[k] - mi) % d != 0)
180 break;
181
182 if (k >= numEntries)
183 D = d;
184 }
185
186 for (k = 0; k < numEntries; k++)
187 index[k] = (index[k] - mi) / D;
188}
189
190void index_expand // assymtric of x->n-x, but this does not matter below
191 (int index[], int numEntries, int max_clusters)

Callers 3

reconstruct.cppFile · 0.70
ep_shaker_2Function · 0.70
ep_shaker_2__Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected