| 954 | } |
| 955 | |
| 956 | std::vector<uint8_t> CompressDXT5(const uint8_t* rgba, int width, int height) |
| 957 | { |
| 958 | size_t sz = CompressedSize(width, height, false); |
| 959 | std::vector<uint8_t> out(sz); |
| 960 | int bw = (width + 3) / 4; |
| 961 | int bh = (height + 3) / 4; |
| 962 | auto* dst = reinterpret_cast<DXTBlock128*>(out.data()); |
| 963 | |
| 964 | for (int by = 0; by < bh; ++by) |
| 965 | { |
| 966 | for (int bx = 0; bx < bw; ++bx) |
| 967 | { |
| 968 | DWORD pixels[16]; |
| 969 | extractBlockARGB(rgba, width, height, bx, by, pixels); |
| 970 | CompressDXT1Block(dst->color, pixels, true); |
| 971 | CompressDXTABlock(dst->alphaImp, pixels); |
| 972 | dst++; |
| 973 | } |
| 974 | } |
| 975 | return out; |
| 976 | } |
| 977 | |
| 978 | } // namespace DXTCompressor |
| 979 |
no test coverage detected