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

Function DecompressFloat

DevIL/src-IL/src/il_dds.cpp:1628–1665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1626
1627
1628ILboolean DecompressFloat(ILuint lCompFormat)
1629{
1630 ILuint i, j, Size;
1631
1632 switch (lCompFormat)
1633 {
1634 case PF_R32F: // Red float, green = blue = max
1635 Size = Image->Width * Image->Height * Image->Depth * 3;
1636 for (i = 0, j = 0; i < Size; i += 3, j++) {
1637 ((ILfloat*)Image->Data)[i] = ((ILfloat*)CompData)[j];
1638 ((ILfloat*)Image->Data)[i+1] = 1.0f;
1639 ((ILfloat*)Image->Data)[i+2] = 1.0f;
1640 }
1641 return IL_TRUE;
1642 case PF_A32B32G32R32F: // Direct copy of float RGBA data
1643 memcpy(Image->Data, CompData, Image->SizeOfData);
1644 return IL_TRUE;
1645 case PF_G32R32F: // Red float, green float, blue = max
1646 Size = Image->Width * Image->Height * Image->Depth * 3;
1647 for (i = 0, j = 0; i < Size; i += 3, j += 2) {
1648 ((ILfloat*)Image->Data)[i] = ((ILfloat*)CompData)[j];
1649 ((ILfloat*)Image->Data)[i+1] = ((ILfloat*)CompData)[j+1];
1650 ((ILfloat*)Image->Data)[i+2] = 1.0f;
1651 }
1652 return IL_TRUE;
1653 case PF_R16F: // Red float, green = blue = max
1654 return iConvR16ToFloat32((ILuint*)Image->Data, (ILushort*)CompData,
1655 Image->Width * Image->Height * Image->Depth * Image->Bpp);
1656 case PF_A16B16G16R16F: // Just convert from half to float.
1657 return iConvFloat16ToFloat32((ILuint*)Image->Data, (ILushort*)CompData,
1658 Image->Width * Image->Height * Image->Depth * Image->Bpp);
1659 case PF_G16R16F: // Convert from half to float, set blue = max.
1660 return iConvG16R16ToFloat32((ILuint*)Image->Data, (ILushort*)CompData,
1661 Image->Width * Image->Height * Image->Depth * Image->Bpp);
1662 default:
1663 return IL_FALSE;
1664 }
1665}
1666
1667
1668void CorrectPreMult()

Callers 1

DdsDecompressFunction · 0.85

Calls 3

iConvR16ToFloat32Function · 0.85
iConvFloat16ToFloat32Function · 0.85
iConvG16R16ToFloat32Function · 0.85

Tested by

no test coverage detected