MCPcopy Create free account
hub / github.com/DentonW/DevIL / ChooseEndpoints

Function ChooseEndpoints

DevIL/src-IL/src/il_dds-save.cpp:1162–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1160#define NormSquared(c) ((c)->r * (c)->r + (c)->g * (c)->g + (c)->b * (c)->b)
1161
1162void ChooseEndpoints(ILushort *Block, ILushort *ex0, ILushort *ex1)
1163{
1164 ILuint i;
1165 Color888 Colours[16];
1166 ILint Lowest=0, Highest=0;
1167
1168 for (i = 0; i < 16; i++) {
1169 ShortToColor888(Block[i], &Colours[i]);
1170
1171 if (NormSquared(&Colours[i]) < NormSquared(&Colours[Lowest]))
1172 Lowest = i;
1173 if (NormSquared(&Colours[i]) > NormSquared(&Colours[Highest]))
1174 Highest = i;
1175 }
1176 *ex0 = Block[Highest];
1177 *ex1 = Block[Lowest];
1178}
1179
1180#undef Sum
1181#undef NormSquared

Callers 1

CompressFunction · 0.85

Calls 1

ShortToColor888Function · 0.85

Tested by

no test coverage detected