logo separator

[mkgmap-dev] [mkgmap-svn] Commit r572: MDR16 is some kind of codebook.

From Gerd Petermann gpetermann_muenchen at hotmail.com on Tue Dec 28 06:43:32 GMT 2021

Hi Ticker,

attached patch implements also a table driven decoder for the adria topo map.
The tree decoder and the table decode give the same values.
I learned that I need this (hardcoded) array for Topo Adra
int[] minCodes = {0,0,0,0,0,0,5,6,3,2,3,3,3,4,3,4,5,6,6,3,0};

I think these numbers are encoded in the struct bytes, but one has to shift the values.
The shift amount is calculated by shift = maxDepth - depth.
So,
06 00 00                | struct/mask for depth 19 ???
gives 6 >> (20-19) = 3
18 00 00                | struct/mask for depth 18 ???
gives 24 >> (20-18) = 4
...
 00 40 01                | struct/mask for depth 6 ???
gives 81920 >> (20 - 6) = 5
Found this last night, the patch doesn't implement this yet.

I'll check your ideas about bytes 0..2. Those are the last which I don't understand.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
Gesendet: Dienstag, 28. Dezember 2021 01:18
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] [mkgmap-svn]  Commit  r572:   MDR16   is      some    kind    of codebook.

Hi Gerd

So, in the first byte of each prefix table entry, the bottom bit =1
means push 0-n bits back, =0 means need to get extra bits to decode. In
both cases the value is >>1 and biased in a strange way. In most cases
variable numbers of bits will be needed, but the minimum is known.
Value of 0 means might need to get bits up to the max encoding length.

Have you come up with a meaning for the second byte of the prefixes
where it isn't a direct character.

I see what you mean about byte 4.

I don't follow what you mean about byte 6 and the length of the last
block.

Other static info that omight be encoded in bytes 0, 1 & 2 could be:
1/ version/subversion
2/ initial bits to read, giving size of prefix table (all 5 so far)
3/ includes refs to mdr29/30 &| 30/31. Which of your test maps have
these sections?

Ticker

On Sun, 2021-12-26 at 19:39 +0000, Gerd Petermann wrote:
> Hi Ticker,
>
> a few more patterns:
> byte 4 seems to relate to the highest stat value in the rows with
> even stat values.
> I see e.g 0x0f  and 0x1c or 0x0a and 0x1b. The formula: byte at 4 =
> highest /2 + 1
>
> byte 6 (x) is related to the number of bytes (y) in the last block.
> (x = y * 2+ 1)
> I see e.g. 0x6b (107) and 53 bytes or 0x6d (109) with 54 bytes or
> 0x5d (93) and 46 bytes.
>
> Gerd
>
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> von Gerd Petermann <gpetermann_muenchen at hotmail.com>
> Gesendet: Donnerstag, 23. Dezember 2021 20:53
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev]       [mkgmap-svn]    Commit  r572:
> MDR16   is      some    kind    of      codebook.
>
> Hi Ticker,
>
> reg. "stat": my rule is a bit different but the result is the same:
> for all odd values:
> depth = usedBits = stat >> 1;
>
> val is the 2nd byte.
> for even stat values and rows where stat == val << 1 the decoder
> has to read  exactly 1 more bit to decide which character was
> encoded.
> I've not yet understood how the stat or the val field can be used to
> find the correct entry
> in the byte array with the characters.
>
> So, maybe the stat value should be shifted to the right to make some
> sense.
>
> Gerd
>
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag
> von Ticker Berkin <rwb-mkgmap at jagit.co.uk>
> Gesendet: Donnerstag, 23. Dezember 2021 15:56
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev]       [mkgmap-svn]    Commit  r572:
> MDR16   is      some    kind    of      codebook.
>
> Hi Gerd
>
> Maybe the "is always 8" is the character width.
>
> I think I understand parts of it.
>
> Read 5 bits and look up, giving 2 bytes.
> if first 3/5/6/9/b the final char in the second byte and return (b-
> first)/2 to the bit stream. Otherwise the combination somehow
> indicate
> a minimum number of more bits to read and where to start searching.
> maybe the 'struct for level' 1 or 2 bytes is a bit flag of which
> levels
> to look in. I notice (in topo_fr) it is normally a single or adjacent
> bits except for 0xa, but there are no chars at level 19
>
> prefix 0 doesn't quite follow the rules
>
> Ticker


_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdr-experimental-table_beta.patch
Type: application/octet-stream
Size: 28833 bytes
Desc: mdr-experimental-table_beta.patch
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20211228/b845de5d/attachment-0001.obj>


More information about the mkgmap-dev mailing list