GithubHelp home page GithubHelp logo

gpuopen-tools / compressonator Goto Github PK

View Code? Open in Web Editor NEW
1.2K 74.0 190.0 722.8 MB

Tool suite for Texture and 3D Model Compression, Optimization and Analysis using CPUs, GPUs and APUs

C++ 78.80% C 17.85% Batchfile 0.27% HTML 0.02% CSS 0.01% Assembly 0.54% GLSL 0.11% HLSL 0.69% CMake 1.07% Shell 0.10% QMake 0.01% Python 0.10% Rich Text Format 0.37% PowerShell 0.05%
texture-compression 3d-models sdk analysis gui-application mipmaps decompression compressonator compression dxtc

compressonator's Introduction

Compressonator

CMake download download

Download the latest revision for changes that have been made since the last major release by clicking the CMake button above or the link here. Currently, only Compressonator Framework and Compressonator CLI are built every revision.

Compressonator is a set of tools to allow artists and developers to more easily create compressed texture assets or model mesh optimizations and easily visualize the quality impact of various compression and rendering technologies. It consists of a GUI application, a command line application and an SDK for easy integration into a developer tool chain.

Compressonator supports Microsoft Windows® and Linux builds.

For more details goto the online Compressonator Documents: http://compressonator.readthedocs.io/en/latest/

Build System Updates

The code is undergoing a build setup update. This notice will be removed when the changes are completed! Currently: To use the sln builds run build\fetch_dependencies.py to fetch required external lib dependencies into a Common folder above this repository.

Get Prebuilt Binaries and Installer here:

Latest release

To build the source files follow the instructions in http://compressonator.readthedocs.io/en/latest/build_from_source/build_instructions.html

CMake Build Configuration

As of v4.2, The cmake command line options have settings to build specific libs and applications

Examples: Generating Visual Studio Solution File

Enable building all
    cmake -G "Visual Studio 15 2017 Win64"  
    
Disable all builds except external libs, minimal cmake base setup     
    cmake -DOPTION_ENABLE_ALL_APPS=OFF -G "Visual Studio 15 2017 Win64"
    
Enable only CLI app build    
    cmake -DOPTION_ENABLE_ALL_APPS=OFF -DOPTION_BUILD_APPS_CMP_CLI=ON -G "Visual Studio 15 2017 Win64"

For more details reference the CMakeList file on the root folder.

Style and Format Change

The source code of this product is being reformatted to follow the Google C++ Style Guide https://google.github.io/styleguide/cppguide.html

In the interim you may encounter a mix of both an older C++ coding style, as well as the newer Google C++ Style.

Please refer to the _clang-format file in the root directory of the product for additional style information.

Compressonator Core

Provides block level API access to updated performance and quality driven BCn codecs. The library is designed to be a small self-contained, cross-platform, and linkable library for user applications.

Example usage is shown as below to compress and decompress a single 4x4 image block using BC1 encoder

// To use Compressonator Core "C" interfaces, just include
// a single header file and CMP_Core lib into  your projects

#include "CMP_Core.h"

// Compress a sample image shape0 which is a 4x4 RGBA_8888 block.
// Users can use a pointer to any sized image buffers to reference
// a 4x4 block by supplying a stride offset for the next row.
// Optional BC1 settings is set to null in this example

unsigned char shape0_RGBA[64] = { filled with image source data as RGBA ...};

// cmpBuffer is a byte array of 8 byte to hold the compressed results.
unsigned char cmpBuffer[8]   = { 0 };

// Compress the source into cmpBuffer
CompressBlockBC1(shape0_RGBA, 16, cmpBuffer,null);

// Example to decompress comBuffer back to a RGBA_8888 4x4 image block
unsigned char imgBuffer[64] = { 0 };
DecompressBlockBC1(cmpBuffer,imgBuffer,null)

Compressonator Framework

Includes Compressonator core with interfaces for multi-threading, mipmap generation, file access of images and HPC pipeline interfaces.

Example Mip Level Processing using CPU

// To use Compressonator Framework "C" interfaces, just include
// a single header file and CMP_Framework lib into  your projects

#include "compressonator.h"

 //--------------------------
 // Init frameworks
 // plugin and IO interfaces
 //--------------------------
 CMP_InitFramework();

//---------------
// Load the image
//---------------
CMP_MipSet MipSetIn;
memset(&MipSetIn, 0, sizeof(CMP_MipSet));
cmp_status = CMP_LoadTexture(pszSourceFile, &MipSetIn);
if (cmp_status != CMP_OK) {
    std::printf("Error %d: Loading source file!\n",cmp_status);
    return -1;
}

//----------------------------------------------------------------------
// generate mipmap level for the source image, if not already generated
//----------------------------------------------------------------------

if (MipSetIn.m_nMipLevels <= 1)
{
    CMP_INT requestLevel = 10; // Request 10 miplevels for the source image

    //------------------------------------------------------------------------
    // Checks what the minimum image size will be for the requested mip levels
    // if the request is too large, a adjusted minimum size will be returned
    //------------------------------------------------------------------------
    CMP_INT nMinSize = CMP_CalcMinMipSize(MipSetIn.m_nHeight, MipSetIn.m_nWidth, 10);

    //--------------------------------------------------------------
    // now that the minimum size is known, generate the miplevels
    // users can set any requested minumum size to use. The correct
    // miplevels will be set acordingly.
    //--------------------------------------------------------------
    CMP_GenerateMIPLevels(&MipSetIn, nMinSize);
}

//==========================
// Set Compression Options
//==========================
KernelOptions   kernel_options;
memset(&kernel_options, 0, sizeof(KernelOptions));

kernel_options.format   = destFormat;   // Set the format to process
kernel_options.fquality = fQuality;     // Set the quality of the result
kernel_options.threads  = 0;            // Auto setting

//=====================================================
// example of using BC1 encoder options 
// kernel_options.bc15 is valid for BC1 to BC5 formats
//=====================================================
if (destFormat == CMP_FORMAT_BC1)
{
    // Enable punch through alpha setting
    kernel_options.bc15.useAlphaThreshold = true;
    kernel_options.bc15.alphaThreshold    = 128;

    // Enable setting channel weights
    kernel_options.bc15.useChannelWeights = true;
    kernel_options.bc15.channelWeights[0] = 0.3086f;
    kernel_options.bc15.channelWeights[1] = 0.6094f;
    kernel_options.bc15.channelWeights[2] = 0.0820f;
}

//--------------------------------------------------------------
// Setup a results buffer for the processed file,
// the content will be set after the source texture is processed
// in the call to CMP_ProcessTexture()
//--------------------------------------------------------------
CMP_MipSet MipSetCmp;
memset(&MipSetCmp, 0, sizeof(CMP_MipSet));

//===============================================
// Compress the texture using Framework Lib
//===============================================
cmp_status = CMP_ProcessTexture(&MipSetIn, &MipSetCmp, kernel_options, CompressionCallback);
if (cmp_status != CMP_OK) {
  ...
}

//----------------------------------------------------------------
// Save the result into a DDS file
//----------------------------------------------------------------
cmp_status = CMP_SaveTexture(pszDestFile, &MipSetCmp);

CMP_FreeMipSet(&MipSetIn);
CMP_FreeMipSet(&MipSetCmp);

Example GPU based processing using OpenCL

// Note: Only MD x64 build is used for GPU processing
// SDK files required for application:
//     compressonator.h
//     CMP_Framework_xx.lib  For static libs xx is either MD or MDd, 
//                      When using DLL's make sure the  CMP_Framework_xx_DLL.dll is in exe path
//
// File(s) required to run with the built application
//
// Using OpenCL (OCL) 
//     CMP_GPU_OCL_MD_DLL.dll    or CMP_GPU_OCL_MDd_DLL.dll
//     Encode Kernel files in plugins/compute folder
//     BC1_Encode_Kernel.cpp
//     BC1_Encode_Kernel.h
//     BCn_Common_kernel.h
//     Common_Def.h
//
// Using DirectX (DXC) 
//     CMP_GPU_DXC_MD_DLL.dll    or CMP_GPU_DXC_MDd_DLL.dll
//     Encode Kernel files in plugins/compute folder
//     BC1_Encode_Kernel.hlsl
//     BCn_Common_kernel.h
//     Common_Def.h

#include "compressonator.h"

CMP_FORMAT      destFormat = CMP_FORMAT_BC1;

//---------------
// Load the image
//---------------
CMP_MipSet MipSetIn;
memset(&MipSetIn, 0, sizeof(CMP_MipSet));
if (CMP_LoadTexture(pszSourceFile, &MipSetIn) != CMP_OK) {
    std::printf("Error: Loading source file!\n");
    return -1;
  } 

 //-----------------------------------------------------
 // when using GPU: The texture must have width and height as a multiple of 4
 // Check texture for width and height
 //-----------------------------------------------------
 if ((MipSetIn.m_nWidth % 4) > 0 || (MipSetIn.m_nHeight % 4) > 0) {
    std::printf("Error: Texture width and height must be multiple of 4\n");
    return -1;
 }
    
//----------------------------------------------------------------------------------------------------------
// Set the target compression format and the host framework to use
// For this example OpenCL is been used
//-----------------------------------------------------------------------------------------------------------
KernelOptions   kernel_options;
memset(&kernel_options, 0, sizeof(KernelOptions));

kernel_options.encodeWith = CMP_GPU_OCL;         // Using OpenCL GPU Encoder, can replace with DXC for DirectX
kernel_options.format     = destFormat;          // Set the format to process
kernel_options.fquality   = fQuality;            // Set the quality of the result

//--------------------------------------------------------------
// Setup a results buffer for the processed file,
// the content will be set after the source texture is processed
// in the call to CMP_ProcessTexture()
//--------------------------------------------------------------
CMP_MipSet MipSetCmp;
memset(&MipSetCmp, 0, sizeof(CMP_MipSet));

//===============================================
// Compress the texture using Framework Lib
//===============================================
cmp_status = CMP_ProcessTexture(&MipSetIn, &MipSetCmp, kernel_options, CompressionCallback);
if (cmp_status != CMP_OK) {
  ...
}

//----------------------------------------------------------------
// Save the result into a DDS file
//----------------------------------------------------------------
cmp_status = CMP_SaveTexture(pszDestFile, &MipSetCmp);

CMP_FreeMipSet(&MipSetIn);
CMP_FreeMipSet(&MipSetCmp);

Compressonator SDK

Compressonator SDK supported codecs includes BC1-BC7/DXTC, ETC1, ETC2, ASTC, ATC, ATI1N, ATI2N, all available in a single library.

With the new SDK installation, several example applications with source code are provided that demonstrate how easy it is to add texture compression to your own applications using either "High Level" or "Block Level" APIs.

A simple thread safe interface can compress, decompress and transcode any image as required

CMP_ConvertTexture(CMP_Texture* pSourceTexture, CMP_Texture* pDestTexture,...);

For Example:

// To use Compressonator's portable "C" interfaces, just include
// a single header file and Compresonator.lib into  your projects

#include "Compressonator.h"
...

//==========================
// Load Source Texture
//==========================
CMP_Texture srcTexture;
// note that LoadDDSFile function is a utils function to initialize the source CMP_Texture
// you can also initialize the source CMP_Texture the same way as initialize destination CMP_Texture
if (!LoadDDSFile(pszSourceFile, srcTexture))
{
  ...
}

//===================================
// Initialize Compressed Destination
//===================================
CMP_Texture destTexture;
destTexture.dwSize     = sizeof(destTexture);
destTexture.dwWidth    = srcTexture.dwWidth;
destTexture.dwHeight   = srcTexture.dwHeight;
destTexture.dwPitch    = 0;
destTexture.format     = CMP_FORMAT_BC6H;
destTexture.dwDataSize = CMP_CalculateBufferSize(&destTexture);
destTexture.pData      = (CMP_BYTE*)malloc(destTexture.dwDataSize);

//==========================
// Set Compression Options
//==========================
CMP_CompressOptions options = {0};
options.dwSize       = sizeof(options);
options.fquality     = 0.05f;
options.dwnumThreads = 8;

//==========================
// Compress Texture
//==========================
CMP_ERROR   cmp_status;
cmp_status = CMP_ConvertTexture(&srcTexture, &destTexture, &options, &CompressionCallback, NULL, NULL);
if (cmp_status != CMP_OK)
{
  ...
}

//==========================
// Save Compressed Testure
//==========================
SaveDDSFile(pszDestFile, destTexture))

free(srcTexture.pData);
free(destTexture.pData);

Compressonator CLI

Command line application that can be batch processed and supports:

  • Texture Compression, Decompression, Format Transcoding.
  • 3D Model Optimization and Mesh Compression.
  • Performance and Analysis Logs such as SSIM, MSE, PSNR.
  • MIP Maps, Image Differences, etc. ...
C:\>CompressonatorCLI -fd BC7 .\images .results
C:\>CompressonatorCLI -log -fd BC7 .\images\ruby.png ruby_bc7.dds
CompressonatorCLI Performance Log v1.0

Source        : .\images\ruby.png, Height 416, Wideth 576, Size 0.936 MBytes
Destination   : ruby_bc7.dds
Using         : CPU
Quality       : 0.05
Processed to  : BC7        with  1 iteration(s) in 1.422 seconds
MSE           : 0.78
PSNR          : 49.2
SSIM          : 0.9978
Total time    : 1.432 seconds

--------------

Compressonator GUI

Comprehensive graphical application that can be used to visualize Images and 3D Models, with support for:

  • Texture Compression, Decompression, Format Transcoding.
  • 3D Model Optimization and Mesh Compression.
  • Multiple Image and 3D Model Views.
  • MIP Maps, Differences, Analysis, etc. ...

screenshot 1

glTF 2.0 Model Render View

screenshot 2

Contributors

Compressonator's GitHub repository (http://github.com/GPUOpen-Tools/Compressonator) is moderated by Advanced Micro Devices, Inc. as part of the GPUOpen initiative.

AMD encourages any and all contributors to submit changes, features, and bug fixes via Git pull requests to this repository.

Users are also encouraged to submit issues and feature requests via the repository's issue tracker.

compressonator's People

Contributors

akb825 avatar anteru avatar cdwfs avatar cyrilcourvoisier avatar decorawr avatar denislevesqueamd avatar dsleep avatar flakebi avatar germanaizek avatar ifiddynine avatar jspohr avatar lubosz avatar merihtaze avatar meyraud705 avatar michaliskambi avatar mlvdm avatar navntcmp avatar npcompress avatar s9w avatar silverlan avatar skrphv avatar slaweknowy avatar stonewolf avatar thaeseler-amd avatar thennequin avatar thesmallcreeper avatar uebelandre avatar w23 avatar xooiamd avatar zeitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compressonator's Issues

[Request] OSX Support

My team makes WebGL games, we all use OS X, and our artists need to export to ATC on a regular basis. I haven't been able to find an ATC converter for OS X. It would be fantastic if Compressonator added Mac/Unix build support at least for the command line tool. Is that a possibility?

How to visualize the quality impact of various compression technologies?

Compressonator is a set of tools to allow artists and developers to more easily create compressed texture assets or model mesh optimizations and easily visualize the quality impact of various compression and rendering technologies

So... I download it, run it, open "BC7 Compression" sample project from welcome page. I see a boat there, I see other images... but I do not see how to "easily visualize the quality impact of various compression and rendering technologies". WTF?! I "add destination settings", but then I want to be able to flip different formats and see it right there the difference.

For example, I zoom the boat 10x, and I press ASTC format in the left project window and I want the same picture to be at the same position and zoom level but shown after it was compressed. Or there is different meaning to "easily visualize", or I'm not doing something right?

CLI options related to mipmap generation could use documentation/clarification

The -mipsize could have better documentation.

Isn't possible to let the tool compute the number for a complete mipmap chain ?

It seems that there are issues when the given values are wrong, leading to unclear error messages such as, for a 1024x1024 RGB8 TIF :

CompressonatorCLI.exe xxx.TIF xxx.ktx -fd ETC2_RGB -Quality 1.0000 -mipsize 1024

gives

Compression progress = 100
Error(0): KTX Plugin ID(1) saving file = xxx.ktx
Error: saving image or format is unsupported

while

CompressonatorCLI.exe xxx.TIF xxx.ktx -fd ETC2_RGB -Quality 1.0000 -mipsize 512

works fine.

Could it be related to the compression format block size ?

Can't save the ASTC to KTX with mip maps levels

Hello!
How to reproduce

  1. Open image in some format (tga)
  2. generate mip maps
  3. Select ASTC format in Destination options
  4. Select KTX in Destination options
  5. Process Selected images
    We can see in output window:

Error(0): KTX Plugin ID(1) saving file = some_correct_path/Bush_02_1.KTX
Error: saving image or format is unsupported

Note:

  1. If select *.ASTC file extension with mip maps is working fine
  2. Without mip maps ASTC to *.ktx is working fine

No outputed file when you try to create a file without .DDS ext for ATC

When you try to compress a file with ATC but use in the command line something else than a .DDS extension, it fails silently.

Because of android devices, it is needed to have both DXT and ATC compressed textures available in your app, so renaming ATC DDS files to something else (like .atc) is quiet common practice.

Anyway, the CLI should at last produce an error, ot better, accept any kind of extension, like the 1.5.

Regards.

DXT1A Wrong threating of Alpha Channel (CompressonatorCLI)

Hi,

I have a texture in tga format with alpha channel and I want to compress it to DXT1 with 1bit alpha.

Following command:

CompressonatorCLI.exe -fd DXT1 -DXT1UseAlpha 1 -nomipmap source.tga compressed.dds

Will produce DXT1 image without alpha at all.

Following command:

CompressonatorCLI.exe -fd DXT1 -DXT1UseAlpha 1 -AlphaThreshold 255 -nomipmap source.tga compressed.dds

however, will give me desired result.

As far as I know the black color in alpha mask is "0", so it's surely should be less then "128", but somehow it's not working and such values are ignored.

Source texture that was used: http://s000.tinyupload.com/download.php?file_id=02204180364423075394&t=0220418036442307539465752

Maybe I'm missing something?

Thanks!

MSVC 2015 build fails with a fresh checkout, IMGAnalysis, REPORT_DATA missing members

Here the relevant portion of the build log

1>------ Build started: Project: IMGAnalysis, Configuration: Release_MD Win32 ------
1>  CAnalysis.cpp
...
1>..\CAnalysis.cpp(195): error C2039: 'srcdecodePattern': is not a member of 'REPORT_DATA'
1>  d:\projets\_github\compressonator\compressonator\applications\_plugins\common\TestReport.h(14): note: see declaration of 'REPORT_DATA'
...
1>..\CAnalysis.cpp(199): error C2039: 'destdecodePattern': is not a member of 'REPORT_DATA'
1>  d:\projets\_github\compressonator\compressonator\applications\_plugins\common\TestReport.h(14): note: see declaration of 'REPORT_DATA'
...
2>------ Build started: Project: CompressonatorCLI, Configuration: Release_MD Win32 ------
2>LINK : fatal error LNK1104: cannot open file 'IMGAnalysis.lib'
========== Build: 0 succeeded, 2 failed, 7 up-to-date, 0 skipped ==========

CMP_ConvertTexture(...) is not thread-safe

CMP_ConvertTexture(...), as mentioned in the Example1 here is not thread safe. If one calls the function in a multi-threaded fashion, crashes in the BlockEncoder.

As suggested by David Wilkinson @ AMD, one work around is to wrap the call with mutexes. I used a std::lock_guard<std::mutex>.

CompressonatorLib.sln doesn't compile out-of-box

I pulled the repo today to test the BC6H_SF16 encoding (I need to make a modification to test exactly one mode against some data), and the sln doesn't compile in VS2015.

It first complains that CMP_BYTE is not defined in GT_Encode.h and GT_Decode.h, then claims that CMP_NULL does not exist, which is used everywhere. I fixed those by hooking in Compressonator.h and #defining CMP_NULL to 0, but the GT code also depends on "GTEncodeThreadParam", which doesn't seem to exist as a symbol anywhere in the repo.

Since I don't need the GT code, I'm just going to piecemeal comment the offending code, but I felt that maybe these issues should be addressed for future users.

batch .tga to mipmap .DDS

I'm trying to batch convert about 900 or so images in batches of about 101 with mipmaps.
This conversion works fine in the compressonator gui. (Edit: Version 2.4.3214.0)
example:
ProgressBarBattery_SC_000.tga
mipmap level set to 5

Converting to DXT5
Quality set to 0.5000
Adaptive is unchecked

Name: ProgressBarBattery_SC_000 | Dropdown is on DDS

Source is D:/ Drive | Destination is D:/ Drive In an alternate Folder
Settings saved | Process | ===Compress: 1 succeeded, 0 failed===
I check the file and.... Perfection

Then I export the settings to batch file. I made multiple batch files for image sets in groups of 101. Double checked my batch files and saved. Placed the bat files in the compressonator install folder(C:/Program Files/Compressonator and ran first batch file. Bat file ran and closed so I checked my processed file folder and... its empty?

Okay so need a small test to see whats going on. Back to original test image.
I delete the test result from the gui from earlier. Open the original batch and it lines up with what is shown in Output window of gui. I run the bat file and.... processed folder is empty. HUH?
so I add a cmd command I remembered of the top of my head to the test bat file.
pause
Ran the bat file again and yay it paused. This is what I see.

CompressonatorCLI.exe "D:/...(EDITED).../ProgressBarBattery_SC_000.tga" "D:/...(EDITED).../ProgressBarBattery_SC_000.DDS" -fd DXT5 -miplevels 5 -Quality 0.5000
Source Texture size = 1048576 Bytes, width = 512 px height = 512 px
Destination Texture size = 262144 Bytes Resulting compression ratio = 4.00:1
Compression progress = 94Source Texture size = 262144 Bytes, width
= 256 px height = 256 px
Destination Texture size = 65536 Bytes Resulting compression ratio = 4.00:1
Compression progress = 88 MipLevel = 2Source Texture size = 65536 Bytes, width
= 128 px height = 128 px
Destination Texture size = 16384 Bytes Resulting compression ratio = 4.00:1
Compression progress = 75 MipLevel = 3Source Texture size = 16384 Bytes, width
= 64 px height = 64 px
Destination Texture size = 4096 Bytes Resulting compression ratio = 4.00:1
Compression progress = 50 MipLevel = 4Source Texture size = 4096 Bytes, width
= 32 px height = 32 px
Destination Texture size = 1024 Bytes Resulting compression ratio = 4.00:1
Compression progress = 0 MipLevel = 5Source Texture size = 1024 Bytes, width
= 16 px height = 16 px
Destination Texture size = 256 Bytes Resulting compression ratio = 4.00:1
Compression progress = 100 MipLevel = 6Error: saving image or format is unsupp
orted

Is it a bug in the batch converter code or
Do I Need to convert from tga to something else then to .dds?
If I need to double convert then what should I convert to before moving to .dds conversion?

Edit
Okay... ran another test. Moved the target file from D drive to the compressonator image folder.
Source C:\Program Files\Compressonator\images\ProgressBarBattery_SC
Desti.... C:\Program Files\Compressonator\images\ProgressBarBattery_SC2

Converted properly from bat. I can work with this. Seems to have issue with heavily nested folder paths or folder paths with long names.

C:/Program Files/Compressonator/images/ProgressBarBattery_SC/ProgressBarBattery_SC_000.tga
Worked
D:/ProgressBarBattery_SC/ProgressBarBattery_SC_000.tga
Worked
D:/Modding Files/ProgressBarBattery_SC/ProgressBarBattery_SC_000.tga
Worked
D:/Modding Files/Space Engineers/ProgressBarBattery_SC/ProgressBarBattery_SC_000.tga
Worked
D:/Modding Files/Space Engineers/Test Mod Textures/ProgressBarBattery_SC/ProgressBarBattery_SC_000.tga
Failure

I was working from deeper folders than that. I do love my folders... ugh. well i can work with this by moving my files then doing batch convert then moving them to where I want them. Still easier than the alternative.

Yes I have admin rights. I'm the only one that uses this personally built pc. Even if I didn't, I know how to give myself permissions. I didn't do the admin cmd bit i've just been running the bat directly by double clicking on it.

But seriously check that out and see if you could do something about that path length issue. would be greatly appreciated. Keep up the great work. XD Thanks

Channels of ATC codec are swizzled (BGR instead of RGB)

TL;DR: When Compressonator generate a texture using ATC codec (and DDS container, with CLI) the result texture channels are BGR instead of RGB


For the following image: image4x4 (4x4 image, generated with bash and ImageMagick: printf '\xFF\x00\x00\x69\x00\xFF\x00\xFF\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\xFF\x00\x00\xFF\x00\xFF\x00\xFF\xFF\x00\x00\xFF\xFF\x00\x00\xFF\xFF\x00\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF\x00\xFF' | convert -depth 8 -size 4x4+0 rgba:- image4x4.png)

Compress it using: CompressonatorCLI.exe -nomipmap -fd ATC_RGBA_Explicit image4x4.png image4x4.dds

When I using this compressed texture with a device like LG Nexus 5X (Adreno 418) the colors are incorrect (B and R channels are inverted)

If you take the last 8 bytes (the RGB part of ATC block compression, skipping container header(s) and alpha part of the block), you get: 1F 00 E0 07 CC CF C0 FF.
If I read the 4 first bytes by hand (match block color0 and color1) I get:

color0 = 1F 00 (LE) = 0x001F = (skip first bit),0b00000,0b00000,0b11111 = 0,0,31 => rgb(0,0,255) = blue (incorrect)
color1 = E0 07 (LE) = 0x07E0 = 0b00000,0b111111,0b00000 = 0,63,0 => rgb(0,255,0) = green (correct)

If I use an other tool (like Adreno Texture Tool - QCompress output to DDS or KTX) the result will be 00 7C E0 07 CC CF C0 FF (I can also check with DXT5 which formats look very similar). I've got:

color0 = 00 7C (LE), 0x7C00 = (skip first bit),0b11111,0b00000,0b00000 = 31,0,0 = rgb(255,0,0) = red (correct)
color1 = E0 07 (LE), 0x07E0 = 0b00000,0b111111,0b00000 = 0,63,0 = rgb(0,255,0) = green (correct)

Besides, the only information I found about ATC codec format is a paper about converting DXT to ATC.


I think the cause is from RGBA8888_CHANNEL_… used in CCodec_ATC::CompressRGBBlock. rgbBlock is read as (how I read it):

struct colorData{
	char B;//RGBA8888_CHANNEL_B=0
	char R;//RGBA8888_CHANNEL_G=1
	char G;//RGBA8888_CHANNEL_R=2
	char A;//RGBA8888_CHANNEL_A=3
}
struct rgbBlock colorData[16];

ETC2 - Support for sRGB and EAC still missing

The release notes for v2.3 stated that "Alpha and SRGB based ETC2 support will be supplied in future releases". As of v2.7 they still seem to be missing, which is a shame, because some tests I ran suggests that compression speeds for ETC2_RGB seem to exceed all other viable tools out there, even etc2comp.

Any news on this?

Build bat files don't work if the dir containing them is called "Compressonator"

Also that's the default dir name when cloning from github so it's pretty bad.

The reason is that the batch file first sets the correct root dir:
IF EXIST %BatchDir%\Compressonator (set COMPRESSONATOR_ROOT=%CD%\Compressonator)

But a couple lines after that also finds this wrong dir:
IF EXIST %BatchDir%\..\Compressonator (set COMPRESSONATOR_ROOT=%CD%\..\Compressonator)

SDK example does not compile

Because of missing headers. Compressonator_Test.cpp includes Compressonator.h which does not exist in the SDK. There is only Compress.h which itself tries to pull in lots of headers which are not included in the SDK.

When converting Images to KTX file format internal formats don't match image type.

When I coerced Compressenator into saving a file that was originally a TGA to a KTX file format I get a minor error in the header:
The glInternalFormat in the KTX header is being set to the same value as the glFormat such as GL_RGBA. But the KTX format spec says this should be the sized internal format such as GL_RGBA8.
Here's a link: (they include a link to the format table)
https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#2.6

Library build instructions

For Godot, we are interested in bundling only the compressor code inside of the engine. Is it available as a static library that can be compiled on Linux, Windows and OSX?

Signed or unsigned BC4 format

For the BC4 and BC5 formats, there are signed and unsigned encoding, which one is supported by Compressonator?

And please specify that in the document.

RGB -> BC1 is swiveled incorrectly

It seems that using input textures in RGB or RGBA(CMP_FORMAT_RGBA_8888) format, with an output of BC1 will swivel the blue and red channels, resulting in a BC1 texture in BGR format.

If I swivel my input textures data so that it is instead BRGA, and set format to CMP_FORMAT_BGRA_8888, it will produce the correct output, a BC1 texture in RGB format.

Also using an input of CMP_FORMAT_BGR_888 appears to break things, as this produces a completely black BC1 output texture.

Options I'm setting:

CMP_CompressOptions options;
memset(&options, 0, sizeof(options));

options.bDXT1UseAlpha = false;
options.bDisableMultiThreading = false;
options.dwSize = sizeof(options);
options.fquality = 1.0;

options.nCompressionSpeed = CMP_Speed_Normal;
options.bUseAdaptiveWeighting = true; //not sure what this does..
options.fWeightingBlue = 0.082;
options.fWeightingRed = 0.3086;
options.fWeightingGreen = 0.6094;	
options.bUseChannelWeighting = true;

Input Format:
CMP_Texture input:
input.dwSize = sizeof(CMP_Texture);
input.dwHeight = width_height;
input.dwWidth = width_height;

input.format = CMP_FORMAT_RGBA_8888;
input.nBlockDepth = 1;
input.nBlockHeight = 4;
input.nBlockWidth = 4;
input.pData = const_cast<u8*>(uncompressed);
input.dwDataSize = width_height*width_height * nChannelsInInput;
input.dwPitch = width_height * nChannelsInInput;

Output Texture:
CMP_Texture output;
output.dwSize = sizeof(CMP_Texture);
output.dwHeight = width_height;
output.dwWidth = width_height;
output.dwDataSize = width_height*width_height * BitsPerPixel /8;
output.format = CMP_FORMAT_BC1;

output.nBlockDepth = 1;
output.nBlockHeight = 4;
output.nBlockWidth = 4;
output.dwPitch = width_height *BitsPerPixel/8;

Buffer overflows inside BC7 Codec

Inside the file: Compressonator/Source/Codec/BC7/reconstruct.cpp
Into the body of reconstruct_rnd at line 992:

    int ii[3];

    // cartesian shake
    for (ii[0]=0;ii[0]<2;ii[0]++)
        for (ii[1]=0;ii[1]<2;ii[1]++)
            for (ii[2]=0;ii[2]<2;ii[2]++)
                for (j=0;j<DIMENSION;j++)
                mean_step_r[0][ii[0]+ii[1]*2+ii[2]*4][j]=mean_step_r[1][ii[0]+ii[1]*2+ii[2]*4][j]=
                    mean_r[ii[0]+ii[1]*2+ii[2]*4][j]=mean_r[0][j]+MEAN_DIV*ii[j] >255 ? 255:mean_r[0][j]+MEAN_DIV*ii[j];`

DIMENSION is a constant defined at Compressonator/Header/Codec/BC7/3dquant_constants.h

#define DIMENSION 4

so in the innermost for iteration j can take values in [0,3] interval, overrunning the ii array

Similar issues there are at lines 1303 and 2830 for the ii array and at line 1354 for the mean_step_r array

I'm porting parts of Compressonator Codecs in Linux and GCC simply signaled me those issues.

R and B channels are switched for ETC_RGB compression

If you compress a image using ETC_RGB, then the output DDS have red and blue channels switched. I have tested it on my and several of my colleagues' Andriod phones in WebGL.
If I switch the R and B before the compression, then I get the expected DDS file.
Havn't tested in ETC2.
Should this be fixed?

CCodec_BC6H::~CCodec_BC6H crashes in std::thread

Microsoft Visual Studio Professional 2017
Version 15.3.5

   CMP_CompressOptions compressOptions = {}; // zero initialize struct
   compressOptions.dwSize = sizeof(compressOptions);
   compressOptions.nGPUDecode = GPUDecode_DIRECTX;
   compressOptions.nComputeWith = Compute_DIRECTX;
   compressOptions.nCompressionSpeed = CMP_Speed_Normal;
   compressOptions.bUseAdaptiveWeighting = TRUE;
   compressOptions.fWeightingRed = 0.2126;
   compressOptions.fWeightingGreen = 0.7152;
   compressOptions.fWeightingBlue = 0.0722f;
   compressOptions.bDXT1UseAlpha = isBC1 && hasAlpha;
   compressOptions.nAlphaThreshold = 128;
   compressOptions.dwnumThreads = 8; // crashes without this line

if CCodec_BC6H::m_Use_MultiThreading ends up being false, then the following loop in the destructor of CCodec_BC6H triggers std::terminate inside std::thread because the code is attempting to move a std::thread that hasn't yet completed its func.

        for (unsigned int i = 0; i < m_LiveThreads; i++)
        {
            std::thread& curThread = m_EncodingThreadHandle[i];

            curThread = std::thread(); // FAILS HERE BECAUSE curThread HASN'T TERMINATED
        }

I suspect the code that sets m_EncodeParameterStorage[i].exit = TRUE; and curThread.join() still needs to happen even if only one thread is alive.

Get image properties using CLI

I've read all documentation I could possibly get my hands on, but I could not find if it's possible to just simply read an image using the command line version and echo the properties of the image. For example, when loading an image into the GUI, a "Properties" window has the following information for a DDS file:

Name/Full Path/Full Size/Image Size/Width/Height/Mip Levels/Format

This simple feature would be very useful. When running a task on multiple images that we may not know the specifics to, knowing this information beforehand could allow assigning tasks to different image types within a script.

Gamma Lost compressing PNG -> DDS

I have a bunch of gamma 1.0 (linear) PNG files (they have the GAMA chunk in them) for normal maps. When I convert them to DXT1 DDS files, the DDS files don't have the DX10 header which specifies that the data is linear. Am I missing a switch somewhere?

README: mention dependecy to Qt "imageformats" plugins

To have the CompressonatorCLI understand some image formats, it should have access to Qt image plugins, which are locate in Common\Lib\Ext\Qt\5.5\plugins.

Manually copying the imageformats from Common to CompressonatorCLI's plugins folder does the job.

RXGB Support

Please add RXGB support back to this project.

The GPL release of Doom 3 will mean that many open source study projects will need that format for normal map compression.

Thanks!

Different process for ATC compression ?

Hello,

Before Win10, we were using the old compressonator (1.5) as a CLI inside our own building tools, in java.

We are now trying to use the new version but it looks like this compressonator uses a different process to compress images with ATC. It means that when we try to loop and compress our files, we can't use "process.waitFor();" to know when the compressonator is done with a file.

We do not have this issue for DXT.

Is it a bug ? If not, how can we know when a compression is over ?

Thanks a lot.

Compressed Raw image data to PNG?

I have some image data, compressed with BC3. (It's more like a dds file, but with no header)

Can't I use Compressonator to decompress it and convert it to PNG?

CompressonatorCLI 2.7.3568 doesn't work on Mac

I've built the CLI on my mac with the SHA# 6edae58 but when I run it, I keep getting the same error: "Error: saving image or destination format is unsupported by Qt"

I've tried to use different images(png, jpg, bmp), different compressions but keep getting the same error:

$ ./CompressonatorCLI -fd DXT1 test.jpg test.dds
Source Texture size = 518400 Bytes, width = 360 px height = 360 px
Destination Texture size = 64800 Bytes Resulting compression ratio = 8.00:1
Compression progress = 99 Error: saving image or destination format is unsupported by Qt

$ ./CompressonatorCLI -fd DXT1 test2.jpg test.dds
Source Texture size = 1048576 Bytes, width = 512 px height = 512 px
Destination Texture size = 131072 Bytes Resulting compression ratio = 8.00:1
Compression progress = 99 Error: saving image or destination format is unsupported by Qt

$ ./CompressonatorCLI -fd DXT5 test2.jpg test.dds
Source Texture size = 1048576 Bytes, width = 512 px height = 512 px
Destination Texture size = 262144 Bytes Resulting compression ratio = 4.00:1
Compression progress = 99 Error: saving image or destination format is unsupported by Qt

$ ./CompressonatorCLI -fd ETC_RGB test2.jpg test.dds
Source Texture size = 1048576 Bytes, width = 512 px height = 512 px
Destination Texture size = 131072 Bytes Resulting compression ratio = 8.00:1
Compression progress = 99 Error: saving image or destination format is unsupported by Qt

$ ./CompressonatorCLI -fd ETC_RGB test.png test.dds
Source Texture size = 1048576 Bytes, width = 512 px height = 512 px
Destination Texture size = 131072 Bytes Resulting compression ratio = 8.00:1
Compression progress = 99 Error: saving image or destination format is unsupported by Qt

Can someone please help me?

Can't disable multithreading for ASTC compression

Hi

We currently compress with the multithreading disabled option ("bDisableMultiThreading") and encountered an issue. When we started compressing ASTC textures, we occationally ran into the following error message, coming from ASTC_Encode_Kernel:
"Unable to find an encoding within the specified error limits. Please revise the error limit values and try again."

I tried debugging it and it seems like setting the "bDisableMultiThreading" option to false did not prevent the ASTC encoding from running multithreaded.

In Compress.cpp around line 460 where there is a switch statement "switch(destType)", I saw that for CT_BC7, NumThreads were being set to either the "dwnumThreads" option or 1 depending on the "bDisableMultiThreading" option, but for ASTC, NumThreads were never set, causing it to used the default (8).

Trouble building on my linux mint 17 workstation

Hi there,

Hoping someone can help, as I do not understand why the build is failing and it looks like an issue with the current master version

I am trying to build CompressonatorCLI on my Mint 17 (Ubuntu-based) workstation, based on the README instructions. I have installed the dependencies as per Compressonator/Applications/CompressonatorCLI/Make/initsetup_ubuntu.sh and am now attempting to run buildCLI_ubuntu_cmake.sh. This is failing on the EXR image build with the following errors:

/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: In member function ‘virtual int Plugin_EXR::TC_PluginFileLoadTexture(const char*, CMP_Texture*)’:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:5: error: reference to ‘Array2D’ is ambiguous
     Array2D<Rgba> pixels;
     ^~~~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:55:25: note: candidates are: template<class T> class Imf_2_2::Array2D
 template<class T> class Array2D;
                         ^~~~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:123:7: note:                 template<class T> class Imf::Array2D
 class Array2D
       ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:17: error: expected primary-expression before ‘>’ token
     Array2D<Rgba> pixels;
                 ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:19: error: ‘pixels’ was not declared in this scope
     Array2D<Rgba> pixels;
                   ^~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: In member function ‘virtual int Plugin_EXR::TC_PluginFileSaveTexture(const char*, CMP_Texture*)’:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:5: error: reference to ‘Array2D’ is ambiguous
     Array2D<Rgba> pixels (image_height,image_width);
     ^~~~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:55:25: note: candidates are: template<class T> class Imf_2_2::Array2D
 template<class T> class Array2D;
                         ^~~~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:123:7: note:                 template<class T> class Imf::Array2D
 class Array2D
       ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:17: error: expected primary-expression before ‘>’ token
     Array2D<Rgba> pixels (image_height,image_width);
                 ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:51: error: ‘pixels’ was not declared in this scope
     Array2D<Rgba> pixels (image_height,image_width);
                                                   ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: At global scope:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:21: error: reference to ‘Array’ is ambiguous
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                     ^~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:54:25: note: candidates are: template<class T> class Imf_2_2::Array
 template<class T> class Array;
                         ^~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:76:7: note:                 template<class T> class Imf::Array
 class Array
       ^~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:31: error: expected primary-expression before ‘>’ token
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                               ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:34: error: ‘pixels’ was not declared in this scope
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                  ^~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:48: error: expected primary-expression before ‘*’ token
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:50: error: ‘pMipSet’ was not declared in this scope
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                  ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:59: error: expected primary-expression before ‘int’
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                           ^~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:66: error: expected primary-expression before ‘int’
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                                  ^~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:71: error: expression list treated as compound expression in initializer [-fpermissive]
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                                       ^
make[2]: *** [CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp.o] Error 1
make[1]: *** [CMakeFiles/EXR.dir/all] Error 2
make: *** [all] Error 2

If I comment these out of the script, the build fails later. To my eye this looks like either a compiler version issue or code bug?!? Reporting as an issue in case it is a code bug.

Thanks for your help.

Complete script output follows:

+ set -e
+ export CC=/usr/bin/gcc-6
+ CC=/usr/bin/gcc-6
+ export CXX=/usr/bin/g++-6
+ CXX=/usr/bin/g++-6
+ rm -f ../../_Plugins/CImage/DDS/Make/CMakeCache.txt
+ rm -f -r ../../_Plugins/CImage/DDS/Make/CMakeFiles
+ rm -f ../../_Plugins/CImage/DDS/Make/cmake_install.cmake
+ rm -f ../../_Plugins/CImage/DDS/Make/Makefile
+ cd ../../_Plugins/CImage/DDS/Make/
+ cmake -G 'Unix Makefiles'
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/gcc-6
-- Check for working C compiler: /usr/bin/gcc-6 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-6
-- Check for working CXX compiler: /usr/bin/g++-6 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Finding Package Qt5 (Qt5Core and Qt5Gui). if not found, for Unix, run initsetup_unix.sh to install. For window, please make sure install qt5.7 and add the bin path (i.e. C:/Qt/5.7/msvc2015_64/bin) to your environment PATH.
-- Could NOT find Boost
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/Make
+ make
Scanning dependencies of target DDS
[ 12%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/DDS.cpp.o
[ 25%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/DDS_DX10.cpp.o
[ 37%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/DDS_File.cpp.o
[ 50%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/DDS_Helpers.cpp.o
[ 62%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/DDS/stdafx.cpp.o
[ 75%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/MIPS.cpp.o
[ 87%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/TC_PluginInternal.cpp.o
[100%] Building CXX object CMakeFiles/DDS.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/UtilFuncs.cpp.o
Linking CXX static library libDDS.a
[100%] Built target DDS
+ rm -f ../../_Plugins/CImage/ASTC/Make/CMakeCache.txt
+ rm -f -r ../../_Plugins/CImage/ASTC/Make/CMakeFiles
+ rm -f ../../_Plugins/CImage/ASTC/Make/cmake_install.cmake
+ rm -f ../../_Plugins/CImage/ASTC/Make/Makefile
+ cd ../../_Plugins/CImage/ASTC/Make/
+ cmake -G 'Unix Makefiles'
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/gcc-6
-- Check for working C compiler: /usr/bin/gcc-6 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-6
-- Check for working CXX compiler: /usr/bin/g++-6 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/ASTC/Make
+ make
Scanning dependencies of target ASTC
[ 25%] Building CXX object CMakeFiles/ASTC.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/ASTC/cASTC.cpp.o
[ 50%] Building CXX object CMakeFiles/ASTC.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/MIPS.cpp.o
[ 75%] Building CXX object CMakeFiles/ASTC.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/TC_PluginInternal.cpp.o
[100%] Building CXX object CMakeFiles/ASTC.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/UtilFuncs.cpp.o
Linking CXX static library libASTC.a
[100%] Built target ASTC
+ rm -f ../../_Plugins/CImage/EXR/Make/CMakeCache.txt
+ rm -f -r ../../_Plugins/CImage/EXR/Make/CMakeFiles
+ rm -f ../../_Plugins/CImage/EXR/Make/cmake_install.cmake
+ rm -f ../../_Plugins/CImage/EXR/Make/Makefile
+ cd ../../_Plugins/CImage/EXR/Make/
+ cmake -G 'Unix Makefiles'
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/gcc-6
-- Check for working C compiler: /usr/bin/gcc-6 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-6
-- Check for working CXX compiler: /usr/bin/g++-6 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find Boost
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make
+ make
Scanning dependencies of target EXR
[ 16%] Building CXX object CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/cExr.cpp.o
[ 33%] Building CXX object CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/MIPS.cpp.o
[ 50%] Building CXX object CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/TC_PluginInternal.cpp.o
[ 66%] Building CXX object CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/Common/UtilFuncs.cpp.o
[ 83%] Building CXX object CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp.o
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: In member function ‘virtual int Plugin_EXR::TC_PluginFileLoadTexture(const char*, CMP_Texture*)’:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:5: error: reference to ‘Array2D’ is ambiguous
     Array2D<Rgba> pixels;
     ^~~~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:55:25: note: candidates are: template<class T> class Imf_2_2::Array2D
 template<class T> class Array2D;
                         ^~~~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:123:7: note:                 template<class T> class Imf::Array2D
 class Array2D
       ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:17: error: expected primary-expression before ‘>’ token
     Array2D<Rgba> pixels;
                 ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:156:19: error: ‘pixels’ was not declared in this scope
     Array2D<Rgba> pixels;
                   ^~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: In member function ‘virtual int Plugin_EXR::TC_PluginFileSaveTexture(const char*, CMP_Texture*)’:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:5: error: reference to ‘Array2D’ is ambiguous
     Array2D<Rgba> pixels (image_height,image_width);
     ^~~~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:55:25: note: candidates are: template<class T> class Imf_2_2::Array2D
 template<class T> class Array2D;
                         ^~~~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:123:7: note:                 template<class T> class Imf::Array2D
 class Array2D
       ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:17: error: expected primary-expression before ‘>’ token
     Array2D<Rgba> pixels (image_height,image_width);
                 ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:178:51: error: ‘pixels’ was not declared in this scope
     Array2D<Rgba> pixels (image_height,image_width);
                                                   ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp: At global scope:
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:21: error: reference to ‘Array’ is ambiguous
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                     ^~~~~
In file included from /usr/local/openexr22build/include/OpenEXR/ImfMultiPartInputFile.h:40:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:69:
/usr/local/openexr22build/include/OpenEXR/ImfForward.h:54:25: note: candidates are: template<class T> class Imf_2_2::Array
 template<class T> class Array;
                         ^~~~~
In file included from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/Make/../../../Common/cExr.h:30:0,
                 from /home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:66:
/usr/include/OpenEXR/ImfArray.h:76:7: note:                 template<class T> class Imf::Array
 class Array
       ^~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:31: error: expected primary-expression before ‘>’ token
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                               ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:34: error: ‘pixels’ was not declared in this scope
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                  ^~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:48: error: expected primary-expression before ‘*’ token
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                ^
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:50: error: ‘pMipSet’ was not declared in this scope
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                  ^~~~~~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:59: error: expected primary-expression before ‘int’
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                           ^~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:66: error: expected primary-expression before ‘int’
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                                  ^~~
/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp:188:71: error: expression list treated as compound expression in initializer [-fpermissive]
 bool allocateMipSet(Array<Rgba> &pixels, MipSet* pMipSet, int w, int h)
                                                                       ^
make[2]: *** [CMakeFiles/EXR.dir/home/andy/Downloads/Compressonator-master/Compressonator/Applications/_Plugins/CImage/EXR/EXR.cpp.o] Error 1
make[1]: *** [CMakeFiles/EXR.dir/all] Error 2
make: *** [all] Error 2

BC7 color ramp interpolation

Generation of color ramp uses different math than MSDN example.

Compare:
https://github.com/GPUOpen-Tools/Compressonator/blob/70d7d78f309f762b3c65fd112c2aa06e68ac06c6/Compressonator/Source/Codec/BC7/BC7_utils.cpp#L131-L142

and (from here):

UINT8 interpolate(UINT8 e0, UINT8 e1, UINT8 index, UINT8 indexprecision)
{
    if(indexprecision == 2)
        return (UINT8) (((64 - aWeights2[index])*UINT16(e0) + aWeights2[index]*UINT16(e1) + 32) >> 6);
    else if(indexprecision == 3)
        return (UINT8) (((64 - aWeights3[index])*UINT16(e0) + aWeights3[index]*UINT16(e1) + 32) >> 6);
    else // indexprecision == 4
        return (UINT8) (((64 - aWeights4[index])*UINT16(e0) + aWeights4[index]*UINT16(e1) + 32) >> 6);
}

The difference is that MSDN approach avoids floating-point calculations by using right-shift at the end.

This gives different results, e.g.:

mode 6:
color_bits = 7 + 1
ep0 = 1
ep1 = 82

index_bits = 4
index = 7 (30/64)

MSDN:
((64 - 30) * 1 + 30 * 82) >> 6 == 38

Compressonator:
1.0 * (1.0 - 0.46875) + 82.0 * 0.46875 + 0.5 == 39.46875

Misssing libraries in 3.0 release for Linux

The release tar of 3.0 seems to be missing the following libraries:

  • libjpeg.so.62
  • libpng12.so.0
  • libpangox-1.0.so.0

On Ubuntu 18.04 the last one can be easily resolved by installing libpangox-1.0-0 package, however the other two are older than the ones in the repository and as a result do not work.

Eventual std::bad_alloc when USE_TRACE_WITH_DYNAMIC_MEM is defined

In the BC7 compressor function void Quant_Init(void) if USE_TRACE_WITH_DYNAMIC_MEM is defined I am getting std::bad_alloc exception thrown.

I'm compressing ~1000 images each with 9-12 mip levels, after about 10-20 images it will throw this exception unless I comment out USE_TRACE_WITH_DYNAMIC_MEM

It appears to be throwing from one of these lines(debugger is showing wrong line but it is near this)

        #ifdef USE_TRACE_WITH_DYNAMIC_MEM
            amd_codes[ numClusters][ numEntries ]    = new int[ MAX_TRACE ];
            amd_trs[ numClusters ][ numEntries ]    = new TRACE[ MAX_TRACE ];
        
            assert(amd_codes[ numClusters][ numEntries ]);
            assert(amd_trs[ numClusters ][ numEntries ]);
        #endif

Missing d3d12.dll error dialog on Windows 7 x64

The documentation on Compressonator x64 2.7.3568 led me to believe it works on Windows 7, however using the CLI version, it pops up a dialog "CompressonatorCLI.exe - System Error - The program can't start because d3d12.dll is missing from your computer. Try reinstalling the program to fix this problem." Since DirectX 12 isn't available for Windows 7 this makes the CLI version useless for scripting. The GUI version shows the same dialog. Otherwise the program seems to work fine.

Inconsistency between interpretation of ARGB_8888 between BC1 and BC7

When using a buffer of uint32 as a source texture, compressing that texture to BC7 gives a texture with its red and blue channels mixed up. Using the same source texture and compressing it to BC1 (and possibly BC2 and BC3) gives the correct result.

The input buffer has each pixel encoded as a uint32, with the following format : 0xAARRGGBB. Note that this is stored in memory as BB GG RR AA (little endian). This buffer is casted to a CMP_BYTE* and passed to CMP_ConvertTexture through a CMP_Texture struct with the CMP_FORMAT_ARGB_8888 format.

When compressing this texture to a BC1, the compressor casts the CMP_BYTE buffer to a DWORD buffer (CCodec_DXTC::CompressRGBBlock, line 110), and bitmasks each dword to extract channels information (ex. CompressonatorXCodec.cpp, line 2333). This respect the ARGB channel ordering.

When compressing this texture to a BC7, the compressor directly read the CMP_BYTE buffer and interpret the channels as they appear in memory (Codec_BC7.cpp, line 542). It effectively reads BGRA, but interpret it has RGBA. This is not consistent with the BC1 codec.

There's also seems to be a confusion between the internal and external API relative to the placement of the alpha channel. Fro example, there's CMP_FORMAT_ARGB_8888, but CCodecBuffer_RGBA8888 and no conversion is done when passing the data of a ARGB texture to the RGBA codec.

Is this a known issue or am I missing something?

VS2015 solution doesn't actually build

The files half.h/cpp are missing, this is part of OpenEXR which isn't included in the download.

Downloading OpenEXR doesn't help since then it requires "toFloat.h" which also doesn't exist, apparently they assume you will use their clunky build system to generate it.

Perhaps provide a way to remove this dependency? Do you really need such a clunky dependency just for half float support?

Multithreading can't be disabled for BC6H

Hi,

Even if we pass dwnumThreads==1 and bDisableMultiThreading==false, BC6H compression still runs multithreaded.

// Compression settings
CMP_CompressOptions options;
memset(&options, 0, sizeof(options));
options.dwSize = sizeof(options);
options.fquality = AMD_CODEC_QUALITY_DEFAULT;
options.dwmodeMask = 0xCF;
options.dwnumThreads = 1;
options.bDisableMultiThreading = true;

in CCodec_BC6H::CFinishBC6HEncoding(void)

m_Use_MultiThreading == 1
and
m_LiveThreads == 8

v3.0 Doesn't build on mac

The mac build isn't working with the latest upgrade. I'm able to build successfully when I checkout a branch with the 2.7.3568 with SHA# 6edae58. But not with the latest code. Can you please fix it?

ETCPACK license

If I understand the ETCPACK license correctly, ETCPACK may only be distributed in binary form, with the exception of etcdec.cxx. However, Compressonator distributes etcimage.cxx and etcpack.cxx (as well as etcdec.cxx, which is fine).

Either my understanding of the license is wrong (I don't speak legalese), or this is a problem. Does AMD have an agreement with Ericsson allowing distribution of the source of those files? If so, how should I as a user relate to this? If I click on Fork, do I violate ETCPACK's license since I'm setting up a repository which distributes these files and I'm not covered by such an agreement?

Could a submodule be a solution? Then these files would not be distributed by this repository, strictly speaking, but by Ericsson's repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.