How to decompress ETC2 to RGBA8888

Hi

I used PVRTDecompress.cpp in Native_SDK to decompress pvr files in ETC2 format, then I realized that this only seems to support decompression of the ECT1 format, how do I apply it to the ETC2 format?

Any suggestions would be appreciated.

Thanks
DA

Hi DADADA,

Thanks for your question, and welcome to the PowerVR Developer Forum!

Currently our SDK only implements decompression of ETC1 format, but you can extend the function uint32_t PVRTDecompressETC(const void* pSrcData, uint32_t x, uint32_t y, void* pDestData, uint32_t nMode) in PVRTDecompress.cpp with the code from the Ericsson repository where the ETC1 and ETC2 decompressors are publicly available: GitHub - Ericsson/ETCPACK: Provides code for compression of textures for ETC1, ETC2 and EAC textures

In particular, you could port the code from void uncompressFile(char *srcfile, uint8* &img, uint8 *&alphaimg, int& active_width, int& active_height) in etcpakk.cxx which will open a file in .pkm format containing an ETC2 compressed image and decompress it.

Best regards,
Alejandro

1 Like

Thank you very much for your very detailed response! I will try it tomorrow. :smiling_face_with_three_hearts:

Have a great day!

Hello AlejandroC,

Thank you for your very detailed reply. I have tried to implement it and it does work for etc2 decompression in pvr format. However, when I decompress “slow” quality compressed images with this method, the displayed image is not as clear as the original image.

Is there any solution for this situation? Thank you very much!

Best regards,
DADADA

Hi DADADA,

Glad to know it worked.

Regarding the low quality issue, I would suggest several options:

  • Open with PVRTexTool the .pvr files containing ASTC compressed images and verify everything is correct (quality, texture size, mip map levels, etc). If the problem is here, you might need to compress again the images.

  • Take a PVRCarbon recording of your 3D application and do a bit of profiling. In any frame of the recording, you can do a frame analysis (icon in the top-left area with same symbol as PVRCarbon application):

You can then inspect the details of the ASTC textures, verify if they are the same as in PVRTexTool (quality, texture size, mip map levels, etc):

Alternatively you could also use other tools (like taking a RenderDoc capture) to inspect the details of the compressed ASTC textures, but I recommend PVRCarbon as it is widely tested and optimised for PowerVR GPUs amongst several other platforms.

Best regards,
Alejandro

1 Like

Hello AlejandroC,

Thank you very much! :grinning:

Best regards,
DADADA