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

Function palitizeEndPointsF

cmp_core/shaders/bc6_encode_kernel.cpp:2163–2209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2161#endif
2162
2163void palitizeEndPointsF(BC6H_Encode_local* BC6H_data, CGU_FLOAT fEndPoints[MAX_SUBSETS][MAX_END_POINTS][MAX_DIMENSION_BIG])
2164{
2165 // scale endpoints
2166 CGU_FLOAT Ar, Ag, Ab, Br, Bg, Bb;
2167
2168 // Compose index colors from end points
2169 if (BC6H_data->region == 1)
2170 {
2171 Ar = fEndPoints[0][0][0];
2172 Ag = fEndPoints[0][0][1];
2173 Ab = fEndPoints[0][0][2];
2174 Br = fEndPoints[0][1][0];
2175 Bg = fEndPoints[0][1][1];
2176 Bb = fEndPoints[0][1][2];
2177
2178 for (CGU_INT i = 0; i < 16; i++)
2179 {
2180 // Red
2181 BC6H_data->Paletef[0][i].x = lerpf(Ar, Br, i, 15);
2182 // Green
2183 BC6H_data->Paletef[0][i].y = lerpf(Ag, Bg, i, 15);
2184 // Blue
2185 BC6H_data->Paletef[0][i].z = lerpf(Ab, Bb, i, 15);
2186 }
2187 }
2188 else
2189 { //mode.type == BC6_TWO
2190 for (CGU_INT region = 0; region < 2; region++)
2191 {
2192 Ar = fEndPoints[region][0][0];
2193 Ag = fEndPoints[region][0][1];
2194 Ab = fEndPoints[region][0][2];
2195 Br = fEndPoints[region][1][0];
2196 Bg = fEndPoints[region][1][1];
2197 Bb = fEndPoints[region][1][2];
2198 for (CGU_INT i = 0; i < 8; i++)
2199 {
2200 // Red
2201 BC6H_data->Paletef[region][i].x = lerpf(Ar, Br, i, 7);
2202 // Greed
2203 BC6H_data->Paletef[region][i].y = lerpf(Ag, Bg, i, 7);
2204 // Blue
2205 BC6H_data->Paletef[region][i].z = lerpf(Ab, Bb, i, 7);
2206 }
2207 }
2208 }
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{

Callers 2

CalcShapeErrorFunction · 0.70
EncodePatternFunction · 0.70

Calls 1

lerpfFunction · 0.70

Tested by

no test coverage detected