天天看點

pvr 與 png 的記憶體占用

原文連結: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