MCPcopy Create free account
hub / github.com/carbonengine/trinity / CompressImageDXT5

Function CompressImageDXT5

trinity/Tr2DxtCompressor.cpp:678–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676}
677
678void CompressImageDXT5( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel )
679{
680 uint8_t block[64];
681 uint8_t minColor[4];
682 uint8_t maxColor[4];
683 uint8_t** outData = &outBuf;
684 for( int j = 0; j < height; j += 4, inBuf += width * 4 * 4 )
685 {
686 if( cancel )
687 {
688 return;
689 }
690 for( int i = 0; i < width; i += 4 )
691 {
692 ExtractBlock( inBuf + i * 4, width, block );
693 GetMinMaxColorsWithAlpha( block, minColor, maxColor );
694 EmitByte( maxColor[3], outData );
695 EmitByte( minColor[3], outData );
696 EmitAlphaIndices( block, minColor[3], maxColor[3], outData );
697 EmitWord( ColorTo565( maxColor ), outData );
698 EmitWord( ColorTo565( minColor ), outData );
699 EmitColorIndices( block, minColor, maxColor, outData );
700 }
701 }
702 outputBytes = *outData - outBuf;
703}
704
705void CompressNormalMapDXT5( const uint8_t* inBuf, uint8_t* outBuf, int width, int height, ptrdiff_t& outputBytes, volatile const bool& cancel )
706{

Callers 1

Tr2DxtCompressSurfaceFunction · 0.85

Calls 7

ExtractBlockFunction · 0.85
GetMinMaxColorsWithAlphaFunction · 0.85
EmitByteFunction · 0.85
EmitAlphaIndicesFunction · 0.85
EmitWordFunction · 0.85
ColorTo565Function · 0.85
EmitColorIndicesFunction · 0.85

Tested by

no test coverage detected