Skip to content

Commit

Permalink
Clean up ConvectionKernels API, add ETC1+ETC2 initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
elasota committed Feb 6, 2019
1 parent 1695c3e commit 2e4b6b2
Show file tree
Hide file tree
Showing 30 changed files with 10,533 additions and 7,591 deletions.
7,586 changes: 0 additions & 7,586 deletions ConvectionKernels/ConvectionKernels.cpp

This file was deleted.

25 changes: 25 additions & 0 deletions ConvectionKernels/ConvectionKernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,23 @@ namespace cvtt
int16_t m_pixels[16][4];
};

class ETC2CompressionData
{
protected:
ETC2CompressionData() {}
};

class ETC1CompressionData
{
protected:
ETC1CompressionData() {}
};

namespace Kernels
{
typedef void* allocFunc_t(void* context, size_t size);
typedef void freeFunc_t(void *context, void* ptr, size_t size);

// NOTE: All functions accept and output NumParallelBlocks blocks at once
void EncodeBC1(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
void EncodeBC2(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
Expand All @@ -135,6 +150,16 @@ namespace cvtt
void EncodeBC6HU(uint8_t *pBC, const PixelBlockF16 *pBlocks, const Options &options);
void EncodeBC6HS(uint8_t *pBC, const PixelBlockF16 *pBlocks, const Options &options);
void EncodeBC7(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options);
void EncodeETC1(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options, ETC1CompressionData *compressionData);
void EncodeETC2(uint8_t *pBC, const PixelBlockU8 *pBlocks, const Options &options, ETC2CompressionData *compressionData);

// ETC compression requires temporary storage that normally consumes a large amount of stack space.
// To allocate and release it, use one of these functions.
ETC2CompressionData *AllocETC2Data(allocFunc_t allocFunc, void* context);
void ReleaseETC2Data(ETC2CompressionData *compressionData, freeFunc_t freeFunc);

ETC1CompressionData *AllocETC1Data(allocFunc_t allocFunc, void* context);
void ReleaseETC1Data(ETC1CompressionData *compressionData, freeFunc_t freeFunc);

void DecodeBC6HU(PixelBlockF16 *pBlocks, const uint8_t *pBC);
void DecodeBC6HS(PixelBlockF16 *pBlocks, const uint8_t *pBC);
Expand Down
27 changes: 26 additions & 1 deletion ConvectionKernels/ConvectionKernels.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,36 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ConvectionKernels.cpp" />
<ClCompile Include="ConvectionKernels_API.cpp" />
<ClCompile Include="ConvectionKernels_BC67.cpp" />
<ClCompile Include="ConvectionKernels_BC6H_IO.cpp" />
<ClCompile Include="ConvectionKernels_BCCommon.cpp" />
<ClCompile Include="ConvectionKernels_ETC.cpp" />
<ClCompile Include="ConvectionKernels_IndexSelector.cpp" />
<ClCompile Include="ConvectionKernels_S3TC.cpp" />
<ClCompile Include="ConvectionKernels_SingleFile.cpp" />
<ClCompile Include="ConvectionKernels_Util.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ConvectionKernels.h" />
<ClInclude Include="ConvectionKernels_AggregatedError.h" />
<ClInclude Include="ConvectionKernels_BC67.h" />
<ClInclude Include="ConvectionKernels_BC6H_IO.h" />
<ClInclude Include="ConvectionKernels_BC7_SingleColor.h" />
<ClInclude Include="ConvectionKernels_BCCommon.h" />
<ClInclude Include="ConvectionKernels_Config.h" />
<ClInclude Include="ConvectionKernels_EndpointRefiner.h" />
<ClInclude Include="ConvectionKernels_EndpointSelector.h" />
<ClInclude Include="ConvectionKernels_ETC.h" />
<ClInclude Include="ConvectionKernels_ETC1.h" />
<ClInclude Include="ConvectionKernels_ETC2.h" />
<ClInclude Include="ConvectionKernels_IndexSelector.h" />
<ClInclude Include="ConvectionKernels_IndexSelectorHDR.h" />
<ClInclude Include="ConvectionKernels_PackedCovarianceMatrix.h" />
<ClInclude Include="ConvectionKernels_ParallelMath.h" />
<ClInclude Include="ConvectionKernels_S3TC.h" />
<ClInclude Include="ConvectionKernels_UnfinishedEndpoints.h" />
<ClInclude Include="ConvectionKernels_Util.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
83 changes: 79 additions & 4 deletions ConvectionKernels/ConvectionKernels.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,91 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ConvectionKernels.cpp">
<ClCompile Include="ConvectionKernels_BC6H_IO.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_API.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_BC67.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_BCCommon.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_ETC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_IndexSelector.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_S3TC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_SingleFile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ConvectionKernels_Util.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ConvectionKernels.h">
<Filter>Source Files</Filter>
<ClInclude Include="ConvectionKernels_AggregatedError.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_BC6H_IO.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_BC7_SingleColor.h">
<Filter>Source Files</Filter>
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_BCCommon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_BC67.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_Config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_ETC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_ETC1.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_ETC2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_IndexSelector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_IndexSelectorHDR.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_PackedCovarianceMatrix.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_ParallelMath.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_S3TC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_UnfinishedEndpoints.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_Util.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_EndpointSelector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ConvectionKernels_EndpointRefiner.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading

0 comments on commit 2e4b6b2

Please sign in to comment.