Tiles data format
dimula73 at gmail.com
Wed Jun 16 10:18:52 CEST 2010
> > I think it means that if we make a global compression of the whole data
> > manager with lzf it will be the same 1.6s :)
> And might be about the same compression rate. And is more complex and lose
> possibility to read only certain tiles.
> > Btw, are you going to disable KoStore compression only for data manager
> > for entire document? I think the latter one is not really fun.
> Only for data manager.
ok too =)
> > libz allows it for sure. See deflateInit2() in . *
> > * - http://www.zlib.net/manual.html
> Yes, but all ZIP coder/decoder I have seen call deflateInit2 with
> -MAX_WBITS as
> window bits.
Though it doesn't mean this is the best choice for compressing tiles =)
Ok, it can be quite difficult to modify KoStore for that.
> > Hm... wait! Your idea is even better in some way! We need only one
> > KisTileCompressor that uses different abstract compress engines. Yeah.
> > are right with idea of KisAbstractCompressor. But it should provide a
> > couple of additional interfaces:
> > virtual qint32 estimateCompressedSize(qint32 sourceSize); // <- to be
> > to compress tiles in one pass.
> > virtual void adjustForDataSize(qint32 tileDataSize); // <- this one will
> > configure sliding window size (and friends) for particular
> > What do you think?
> I don't see the point of optimalBufferSize ? or estimateCompressedSize ? In
> case the buffer should be the size of the tile, and the data is saved
> compressed only if the compression result is inferior to the size of the
> I don't see the point in making it more complicated.
Do these engines make compression in-place? If not we need to create buffer
for this. This buffer should be smaller that the tile-size (now, i'm in
doubt whether there is a guarantee for this from the LZ* for maximum size of
compressed data, should take a look at  again). I'm going to have slabs
of compressed tiles, those will be transferred to the disk at once, so i
need to be able to check whether a slab can accept one more tile.
So can we say for sure, that the buffer of some particular size will fit the
compressed tile, before actual compressing?
> Also I don't know how the swapper will work, but for the loading of a file
> is more convenient to have decompressTile(KisTileSP, quint8* buffer); (but
> I would pass data pointer to have an interface that can be easilly used
> outside of the context :) )
Well, KisTile takes col, row as arguments in the constructor, and, more than
that, reports about its creation to the memento manager. But the problem is
we don't know new tile's col,row before calling decompressor (as it
encapsulates the header) .
So there are two possibilities:
Or we pass all the needed arguments for construction of a tile:
KisTileSP decompressTile(quint8* buffer, KisMementoManager* manager);
or we just pass KisTileHashTable as a factory of tiles that will create
tiles with getTileLazy() - i think this is the best choice:
quint32 decompressTile(quint8* buffer, KisTileHashTable* table);
Btw, we need return value to show how many bytes were read from the stream.
 - btw, we can have different KisTileCompressor for every version of kra
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the kimageshop