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

Function CalcShapeError

cmp_core/shaders/bc6_encode_kernel.cpp:2211–2260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2209}
2210
2211CGU_FLOAT CalcShapeError(BC6H_Encode_local* BC6H_data, CGU_FLOAT fEndPoints[MAX_SUBSETS][MAX_END_POINTS][MAX_DIMENSION_BIG], CGU_BOOL SkipPallet)
2212{
2213 CGU_INT maxPallet;
2214 CGU_INT subset = 0;
2215 CGU_FLOAT totalError = 0.0f;
2216 CGU_INT region = (BC6H_data->region - 1);
2217
2218 if (region == 0)
2219 maxPallet = 16;
2220 else
2221 maxPallet = 8;
2222
2223 if (!SkipPallet)
2224 palitizeEndPointsF(BC6H_data, fEndPoints);
2225
2226 for (CGU_INT i = 0; i < MAX_SUBSET_SIZE; i++)
2227 {
2228 CGU_FLOAT error = 0.0f;
2229 CGU_FLOAT bestError = 0.0f;
2230
2231 if (region == 0)
2232 {
2233 subset = 0;
2234 }
2235 else
2236 {
2237 // get the shape subset 0 or 1
2238 subset = BC6_PARTITIONS[BC6H_data->d_shape_index][i];
2239 }
2240
2241 // initialize bestError to the difference for first data
2242 bestError = abs(BC6H_data->din[i][0] - BC6H_data->Paletef[subset][0].x) + abs(BC6H_data->din[i][1] - BC6H_data->Paletef[subset][0].y) +
2243 abs(BC6H_data->din[i][2] - BC6H_data->Paletef[subset][0].z);
2244
2245 // loop through the rest of the data until find the best error
2246 for (CGU_INT j = 1; j < maxPallet && bestError > 0; j++)
2247 {
2248 error = abs(BC6H_data->din[i][0] - BC6H_data->Paletef[subset][j].x) + abs(BC6H_data->din[i][1] - BC6H_data->Paletef[subset][j].y) +
2249 abs(BC6H_data->din[i][2] - BC6H_data->Paletef[subset][j].z);
2250
2251 if (error <= bestError)
2252 bestError = error;
2253 else
2254 break;
2255 }
2256 totalError += bestError;
2257 }
2258
2259 return totalError;
2260}
2261
2262CGU_FLOAT FindBestPattern(BC6H_Encode_local* BC6H_data, CGU_BOOL TwoRegionShapes, CGU_INT8 shape_pattern, CGU_FLOAT quality)
2263{

Callers 2

FindBestPatternFunction · 0.70
EncodePatternFunction · 0.70

Calls 2

absFunction · 0.85
palitizeEndPointsFFunction · 0.70

Tested by

no test coverage detected