[GRASS5] thoughts about runlength encoding

Andrea Antonello moovida at katamail.com
Thu Aug 12 06:17:08 EDT 2004


> Andrea Antonello wrote:
> > just a few thoughts about runlevel encoding.
> > Perhaps someone can tell me if what I'm saying is right.
> >
> > When talking about rle in Grass, we are talking about integer (CELL) file
> > compression.
> > For what I know, Grass's rle is not a standard one.
>
> There isn't any "standard" form of RLE.

Alright...

> Actually, you need to divide by n+1, where n is the number of bytes
> per cell. Each run consists of a one-byte count followed by an n-byte
> value. For pre-3.0 compression, n is always the nbytes field from the
> fileinfo structure (which is cellhd.format + 1); for the newer form
> (cellhd.compressed == 1), n is stored as an extra byte at the
> beginning of each line.

alright, was doing tests on one byte ints

>
> > Done that it's rather easy to get the uncompressed row.
> > Is this right? This would mean, that there can't "hybrid" (i.e. couples
> > and singles) as in the standard rle.
>
> Correct.
>
> BTW, if you're interested in the format of raster files, you should
> probably look at the {get,put}_row2.c files which I posted recently
> (in the "Raster lib and CELL files > 2GB" thread). Hopefully, these
> should be somewhat easier to read than the original versions.

Absolutely :)

> In the long run, I'm hoping to completely re-write the raster I/O
> code. I'm not planning to support RLE compression (other than to allow
> old files to be converted to the new format), but to use zlib for both
> integer and FP formats.

I think that would be the best deal.

> However, a complete re-write is a long way off. In the mean time, I'm
> considering implementing some of the less radical changes as an
> intermediate measure. Primarily, I intend to add support for 64-bit
> offsets on 32-bit platforms (so that raster files aren't limited to
> 2Gb). I'm also thinking about supporting the use of zlib for integer
> maps, as well as the possibility of eliminating the null file.

Thanks for your advices, they are always of big help.

Ciao
Andrea Antonello





-- 
____________________________________________________________________________
"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik

University of Trento
Department of Civil and Environmental Engineering
Via Mesiano, 77 - Trento (ITALY)

Andrea Antonello
tel:  +393288497722
fax:  +390461882672
____________________________________________________________________________





More information about the grass-dev mailing list