| 1160 | #define NormSquared(c) ((c)->r * (c)->r + (c)->g * (c)->g + (c)->b * (c)->b) |
| 1161 | |
| 1162 | void 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 |
no test coverage detected