Tiles data format

Cyrille Berger cberger at cberger.net
Sun Jun 13 14:36:08 CEST 2010


Hello,

One of the thing I want for Krita 2.3 is fast saving. In March, I made an 
experiment where I would compress each tile individually instead of the whole 
result, see [1]. It shown that it would increase the performance of saving by 
about 10 times, at a price of more disk use. The problem is that it would 
require a change in our tile data format, which also means that file created in 
2.3 would not be openable in Krita 2.2, but I do consider it to be a 
reasonable cost.

The current data format starts by the number of tiles, followed by a return 
carriage, and then each tile is in the format: 
"x,y,width,height\n[binarydata]"

So something like that, for instance:
10
0,0,64,64
[64x64xNxd binarydata]0,64,64,64
[64x64xNxd binarydata]0,64,128,64
...
[64x64xNxd binarydata]

I propose to change it to:
TILESNUMBER 10
COMPRESSIONSCHEME NONE
DATA
0,0,64,64
[64x64xNxd binarydata]0,64,64,64
[64x64xNxd binarydata]0,64,128,64
...
[64x64xNxd binarydata]

And when tiles compression is enabled:

The tile header becomes: x, y, width, height, datalength, iscompressed

TILESNUMBER 10
COMPRESSIONSCHEME LZF
DATA
0,0,64,64, 12314, 1
[12314 binarydata]0,64,64,64, 16384, 0
[16384 binarydata]0,64,128,64,141, 1
...
[12412 binarydata]


Krita's 2.3 loading code should be able to detect whether data is in the old 
format or new format by just checking the first character.

The new version should be more future proof, at least it is extensible. I 
don't think this work would conflict with Dmitry's current work, but in case it 
does, please tell me !

[1] http://lists.kde.org/?l=kde-kimageshop&m=126877404917830&w=2

-- 
Cyrille Berger


More information about the kimageshop mailing list