Texture optimising: PNG vs. PVR.CCZ

TexturePacker can create pvr.ccz format texture files, which have been compressed in zlib. Supposedly they are faster to load (on certain hardware) and use less disk and memory space.

However, my tests aren’t matching the claims. I took a sprite sheet that I made in ShoeBox and remade it in TexturePacker in png, png(optimisation level 7) and pvr.ccz, checked their size on disk and size in memory on win7 and Android (samsung galaxy s2). The results are identical across both platforms:

ShoeBox png: 95kb on disk. Won’t compare memory as image dimensions are different.
TP png (0): 160kb on disk. 2470 KB in memory.
TP png (7): 93kb on disk. 2470 KB in memory.
pvr.ccz: 105kb on disk. 2470 KB in memory.

As you can see, the memory usage is identical, and png beats pvr.ccz at disk space. I haven’t tested loading times, mostly because I’m finding it difficult to do on both android and windows with more accuracy than to the second.

Can anybody recommend pvr.ccz over png in cocos2d-x, given that my target platforms are Android and iOS? It seems to me it’s a cocos2d-specific optimisation for apple devices and that it’s just all drawbacks otherwise.

With ccz compression you can encrypt your sprites sheets so no-one can easily rip them off.
Also make sure you select PVRTC2 or PVRTC4 for image format for the pvr file. You will get x16 or x8 less RAM used compared to PNG 8888.
The compressed pvr files will also render faster due to lower memory bandwidth and better texture cache usage.
Beware though, TexturePacker doesn’t yet allow you to create mipmaps. You’ll need to use PVRTexTool for that.

Most Samsung Galaxy S2 can’t do pvr textures. There are many versions of S2 that Samsung released with different GPUs. Mali and Adreno GPUs can’t do native PVR compressed textures… mostly the Android devices that do PVR are the OMAP-based chipsets. If you are seeing it render correctly, then something is expanding your PVR into full 32 bits of RGBA glory.

The only compressed texture format guaranteed to work across all Android devices is ETC1, which you’ll find in Texture Packer as PKM files (because ETC1 doesn’t do alpha, so PKM is ETC1 with the alpha channel compressed separately).

Yes I’m aware of pvr being basically iOS only. As you say, use ETC1 or detect for a better compression format on Android.
The point I was addressing is that duckinferno was using a pvr container for an RGBA uncompressed format. If he does his tests again using PVRTC2 or 4 format he will see substantial memory savings and rendering speed (especially if using mipmaps.)

Cheers, I’ll have to give it a go when I get an apple device to test on. :slight_smile: