通过标头确定给定astc压缩图像的内部格式? [英] Determine internal format of given astc compressed image through its header?

查看:396
本文介绍了通过标头确定给定astc压缩图像的内部格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个基于EbGL的HTML应用程序,该应用程序使用ASTC(自适应可伸缩纹理压缩)压缩纹理加载到我的三角形上.我想知道是否有一种方法可以通过解析ASTC来了解压缩的ASTC映像的内部格式(在我的情况下可能位于远程Web服务器上)是线性"还是"srgb编码"标头.然后,我可以使用获得的internalFormat信息将我的ASTC纹理传递给glCompressedTexImage2D().换句话说,例如我想从任何ASTC压缩映像的标题中知道我的内部格式是COMPRESSED_RGBA_ASTC_4x4_KHR还是COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.有任何线索吗?

I am writing a EbGL based HTML application that uses ASTC (Adaptive Scalable Texture Compression) compressed textures to be loaded on my triangle. I would like to know that does there exists a way to know whether the internal format of the compressed ASTC image(that in my case might be located on a remote web server) is "linear" or "srgb encoded", by parsing the ASTC header. I can then use that internalFormat information obtained to pass my ASTC texture to glCompressedTexImage2D(). In other words, for eg. I want to know whether my internal format is COMPRESSED_RGBA_ASTC_4x4_KHR or COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR from the header of any ASTC compressed image. Any clues?

推荐答案

似乎ASTC文件头确实没有完全描述其内容.它只有尺寸和一些奇怪的魔数",似乎只是一个常数.

It seems that ASTC file header indeed doesn't fully describe its contents. It has only dimensions and some strange 'magic number' which seems to be just a constant.

有关文件标题的信息: http://malideveloper.arm.com/downloads/Stacy_ASTC_white %20paper.pdf (第4-5页,还参考了马里开发人员中心的代码示例,以获取更多线索).

Information about file header: http://malideveloper.arm.com/downloads/Stacy_ASTC_white%20paper.pdf (pages 4-5, it also refers to code samples from Mali Developer Center for more clues).

此处的幻数"仅是一个常量值0x5CA1AB13: http://community.arm.com/thread/3981

'Magic number' explained here as a mere constant value 0x5CA1AB13: http://community.arm.com/thread/3981

您应该在马里开发人员中心论坛上提问-这些家伙非常有帮助,通常反应很快.

You should ask a question at Mali Developer Center forums - these guys are very helpful and usually respond quite fast.

如果外部链接断开,则标题格式:

Header format in case external links go down:

struct astc_header
{
    uint8_t magic [ 4 ];
    uint8_t blockdim_x;
    uint8_t blockdim_y;
    uint8_t blockdim_z ;
    uint8_t xsize [ 3 ];
    uint8_t ysize [ 3 ];
    uint8_t zsize [ 3 ];
};

这篇关于通过标头确定给定astc压缩图像的内部格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆