pvr 与 png 的内存占用

来源:互联网 发布:linux怎么定时任务 编辑:程序博客网 时间:2024/04/28 18:12

原文链接:http://blog.sina.com.cn/s/blog_6fbe210701015j7z.html

Zwoptex 生成的 spritesheet 除了可以导出 png 格式的图片外还有 pvr 格式。

pvr 格式是 iOS 的显示芯片可以直接读取的,不需要经过解析就能直接显示,所以渲染速度更快,更节省内存。

PVRTC2 和 PVRTC4 是两种 pvr 压缩的图像格式,他们都是 pvr 文件。

这两种图像格式比普通图像有更快的加载速度和更小的内存占用。

PVRTC4: Compressed format, 4 bits per pixel, ok image quality

PVRTC2: Compressed format, 2 bits per pixel, poor image quality

一般 pvr 格式文件的图像格式有:

RGBA8888: 32-bit texture with alpha channel, best image quality

RGBA4444: 16-bit texture with alpha channel, good image quality

RGB565: 16-bit texture without alpha channel, good image quality but no alpha (transparency)

图像占用内存的公式是:

numBytes = width * height * bitsPerPixel / 8

也就是说 2048 * 2048 的 RGBA8888 占用内存 16MB,而 PVRTC4 只占用 2MB

原创粉丝点击