| 1381 | } |
| 1382 | |
| 1383 | static void decodeBlockDxt(uint8_t _dst[16*4], const uint8_t _src[8]) |
| 1384 | { |
| 1385 | if (!BX_ENABLED(BIMG_DECODE_BC2 || BIMG_DECODE_BC3) ) |
| 1386 | { |
| 1387 | return; |
| 1388 | } |
| 1389 | |
| 1390 | uint8_t colors[4*3]; |
| 1391 | |
| 1392 | uint32_t c0 = _src[0] | (_src[1] << 8); |
| 1393 | colors[0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8); |
| 1394 | colors[1] = bitRangeConvert( (c0>> 5)&0x3f, 6, 8); |
| 1395 | colors[2] = bitRangeConvert( (c0>>11)&0x1f, 5, 8); |
| 1396 | |
| 1397 | uint32_t c1 = _src[2] | (_src[3] << 8); |
| 1398 | colors[3] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8); |
| 1399 | colors[4] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8); |
| 1400 | colors[5] = bitRangeConvert( (c1>>11)&0x1f, 5, 8); |
| 1401 | |
| 1402 | colors[6] = (2*colors[0] + colors[3]) / 3; |
| 1403 | colors[7] = (2*colors[1] + colors[4]) / 3; |
| 1404 | colors[8] = (2*colors[2] + colors[5]) / 3; |
| 1405 | |
| 1406 | colors[ 9] = (colors[0] + 2*colors[3]) / 3; |
| 1407 | colors[10] = (colors[1] + 2*colors[4]) / 3; |
| 1408 | colors[11] = (colors[2] + 2*colors[5]) / 3; |
| 1409 | |
| 1410 | for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2) |
| 1411 | { |
| 1412 | int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 3; |
| 1413 | _dst[ii+0] = colors[idx+0]; |
| 1414 | _dst[ii+1] = colors[idx+1]; |
| 1415 | _dst[ii+2] = colors[idx+2]; |
| 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | static void decodeBlockDxt1(uint8_t _dst[16*4], const uint8_t _src[8]) |
| 1420 | { |
no test coverage detected