3 Star 4 Fork 1

Gitee 极速下载/astc-encoder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github/workflows
Docs
ChangeLogImg
FormatOverviewImg
Building-BE.md
Building.md
ChangeLog-3x.md
ChangeLog-4x.md
ChangeLog-5x.md
Encoding.md
FileFormat.md
FormatOverview.md
Profiling.md
Terminology.md
Testing.md
Source
Test
Utils
.gitattributes
.gitignore
.gitmodules
.pylintrc
CMakeLists.txt
LICENSE.txt
README.md
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/ARM-software/astc-encoder
克隆/下载
FileFormat.md 1.70 KB
一键复制 编辑 原始数据 按行查看 历史

The .astc File Format

The default file format for compressed textures generated by astcenc, as well as from many other ASTC compressors, is the .astc format. This is a very simple format consisting of a small header followed immediately by the binary payload for a single image surface.

Header

The header is a fixed 16 byte structure, defined as storing only bytes to avoid any endianness issues or incur any padding overhead.

struct astc_header
{
    uint8_t magic[4];
    uint8_t block_x;
    uint8_t block_y;
    uint8_t block_z;
    uint8_t dim_x[3];
    uint8_t dim_y[3];
    uint8_t dim_z[3];
};

Magic number

The 4 byte magic number at the start of the file acts as a format identifier.

    magic[0] = 0x13;
    magic[1] = 0xAB;
    magic[2] = 0xA1;
    magic[3] = 0x5C;

Block size

The block_* fields store the ASTC block dimensions in texels. For 2D images the Z dimension must be set to 1.

Image dimensions

The dim_* fields store the image dimensions in texels. For 2D images the Z dimension must be set to 1.

Note that the image is not required to be an exact multiple of the compressed block size; the compressed data may include padding that is discarded during decompression.

Each dimension is a 24 bit unsigned value that is reconstructed from the stored byte values as:

decoded_dim = dim[0] + (dim[1] << 8) + (dim[2] << 16);

Binary payload

The binary payload is a byte stream that immediately follows the header. It contains 16 bytes per compressed block. The number of compressed blocks is determined from the header information.


Copyright © 2020-2022, Arm Limited and contributors. All rights reserved.

Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/mirrors/astc-encoder.git
git@gitee.com:mirrors/astc-encoder.git
mirrors
astc-encoder
astc-encoder
main

搜索帮助