logo separator

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

From Gerd Petermann gpetermann_muenchen at hotmail.com on Thu Dec 23 01:17:41 GMT 2021

Hi Ticker,

sorry, just noticed that something went wrong with copy&paste because of the \0 character.
Anyway, I think I understand the meaning of the part with the prefixes.
I assume that Garmin reads the first 5 bits and uses this value as an index into a table
which directly follows the first array. This 2nd table is a 32x2 lookup table, where the 2nd byte gives the value
and the first byte some kind of status info which is used to position the bit reader.
This would explain the repeating characters. Something like this:

--------- MDR 16 (decompression codebook Huffman tree) -------------------------
000002b6 | 000000 | 4a                      | ???
000002b7 | 000001 | 03                      | ???
000002b8 | 000002 | 15                      | ???
000002b9 | 000003 | 14                      | 1st level with struct: 20
000002ba | 000004 | 0f 08 85                | ??? (2nd byte always 8?)
000002bd | 000007 | 00 00 00                | struct for 19
000002c0 | 00000a | 14                      | struct level: 20
000002c1 | 00000b | 00                      | count byte 0, delta = 0
000002c2 | 00000c | 06 00 00                | struct for 19
000002c5 | 00000f | 13                      | struct level: 19
000002c6 | 000010 | 06                      | count byte 6, delta = 6
000002c7 | 000011 | 18 00 00                | struct for 18
000002ca | 000014 | 12                      | struct level: 18
000002cb | 000015 | 0f                      | count byte 15, delta = 9
000002cc | 000016 | 30 00 00                | struct for 17
000002cf | 000019 | 11                      | struct level: 17
000002d0 | 00001a | 15                      | count byte 21, delta = 6
000002d1 | 00001b | 50 00 00                | struct for 16
000002d4 | 00001e | 10                      | struct level: 16
000002d5 | 00001f | 19                      | count byte 25, delta = 4
000002d6 | 000020 | 80 00 00                | struct for 15
000002d9 | 000023 | 0f                      | struct level: 15
000002da | 000024 | 1c                      | count byte 28, delta = 3
000002db | 000025 | c0 00 00                | struct for 14
000002de | 000028 | 0e                      | struct level: 14
000002df | 000029 | 1e                      | count byte 30, delta = 2
000002e0 | 00002a | 00 02 00                | struct for 13
000002e3 | 00002d | 0d                      | struct level: 13
000002e4 | 00002e | 23                      | count byte 35, delta = 5
000002e5 | 00002f | 00 03 00                | struct for 12
000002e8 | 000032 | 0c                      | struct level: 12
000002e9 | 000033 | 25                      | count byte 37, delta = 2
000002ea | 000034 | 00 06 00                | struct for 11
000002ed | 000037 | 0b                      | struct level: 11
000002ee | 000038 | 28                      | count byte 40, delta = 3
000002ef | 000039 | 00 0c 00                | struct for 10
000002f2 | 00003c | 0a                      | struct level: 10
000002f3 | 00003d | 2b                      | count byte 43, delta = 3
000002f4 | 00003e | 00 10 00                | struct for 9
000002f7 | 000041 | 09                      | struct level: 9
000002f8 | 000042 | 2c                      | count byte 44, delta = 1
000002f9 | 000043 | 00 30 00                | struct for 8
000002fc | 000046 | 08                      | struct level: 8
000002fd | 000047 | 30                      | count byte 48, delta = 4
000002fe | 000048 | 00 c0 00                | struct for 7
00000301 | 00004b | 07                      | struct level: 7
00000302 | 00004c | 39                      | count byte 57, delta = 9
00000303 | 00004d | 00 40 01                | struct for 6
00000306 | 000050 | 06                      | struct level: 6
00000307 | 000051 | 3d                      | count byte 61, delta = 4
00000308 | 000052 | 00 0c                   | prefix 00000 : stat=0 v='
', 0xc
0000030a | 000054 | 18 0d                   | prefix 00001 : stat=24 v='
', 0xd
0000030c | 000056 | 1a 0e                   | prefix 00010 : stat=26 v='', 0xe
0000030e | 000058 | 1c 0e                   | prefix 00011 : stat=28 v='', 0xe
00000310 | 00005a | 1c 0e                   | prefix 00100 : stat=28 v='', 0xe
00000312 | 00005c | 0b 43                   | prefix 00101 : stat=11 v='C', 0x43
00000314 | 00005e | 0b 53                   | prefix 00110 : stat=11 v='S', 0x53
00000316 | 000060 | 0b 44                   | prefix 00111 : stat=11 v='D', 0x44
00000318 | 000062 | 0b 54                   | prefix 01000 : stat=11 v='T', 0x54
0000031a | 000064 | 0b 4d                   | prefix 01001 : stat=11 v='M', 0x4d
0000031c | 000066 | 0b 56                   | prefix 01010 : stat=11 v='V', 0x56
0000031e | 000068 | 0b 4a                   | prefix 01011 : stat=11 v='J', 0x4a
00000320 | 00006a | 0b 4b                   | prefix 01100 : stat=11 v='K', 0x4b
00000322 | 00006c | 0b 4c                   | prefix 01101 : stat=11 v='L', 0x4c
00000324 | 00006e | 09 00                   | prefix 01110 : stat=9 v='.', 0x0
00000326 | 000070 | 09 00                   | prefix 01111 : stat=9 v='.', 0x0
00000328 | 000072 | 09 20                   | prefix 10000 : stat=9 v=' ', 0x20
0000032a | 000074 | 09 20                   | prefix 10001 : stat=9 v=' ', 0x20
0000032c | 000076 | 09 45                   | prefix 10010 : stat=9 v='E', 0x45
0000032e | 000078 | 09 45                   | prefix 10011 : stat=9 v='E', 0x45
00000330 | 00007a | 09 4e                   | prefix 10100 : stat=9 v='N', 0x4e
00000332 | 00007c | 09 4e                   | prefix 10101 : stat=9 v='N', 0x4e
00000334 | 00007e | 09 4f                   | prefix 10110 : stat=9 v='O', 0x4f
00000336 | 000080 | 09 4f                   | prefix 10111 : stat=9 v='O', 0x4f
00000338 | 000082 | 09 49                   | prefix 11000 : stat=9 v='I', 0x49
0000033a | 000084 | 09 49                   | prefix 11001 : stat=9 v='I', 0x49
0000033c | 000086 | 09 52                   | prefix 11010 : stat=9 v='R', 0x52
0000033e | 000088 | 09 52                   | prefix 11011 : stat=9 v='R', 0x52
00000340 | 00008a | 07 41                   | prefix 11100 : stat=7 v='A', 0x41
00000342 | 00008c | 07 41                   | prefix 11101 : stat=7 v='A', 0x41
00000344 | 00008e | 07 41                   | prefix 11110 : stat=7 v='A', 0x41
00000346 | 000090 | 07 41                   | prefix 11111 : stat=7 v='A', 0x41

Obviously, for the prefixes 00000..00100 the decode has to read more bits to find the position in the rest of the mdr16 section...
stat=7 means 3 bits where processed, stat=9 means 4 bits where processed, stat=11 means 5 bits where processed.
Have to double check this...

Gerd
________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Gerd Petermann <gpetermann_muenchen at hotmail.com>
Gesendet: Mittwoch, 22. Dezember 2021 15:22
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev]       [mkgmap-svn]    Commit  r572:   MDR16   is      some    kind    of      codebook.

Hi Ticker,

I think those are the two that I didn't post before.

Gerd

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

Hi Gerd

Can you send me the Mdr16 display of some of the other maps you've been
looking at. I'd like to try and find some meaning for bytes 0..2 and
the prefix before the level 5 data.

Thanks
Ticker


On Wed, 2021-12-22 at 08:43 +0000, Gerd Petermann wrote:
> Hi Ticker,
>
> I also thought that some bytes may tells us the uncompressed size or
> frequencies. I don't see any clear pattern so far...
>
> Some number for the Adria Topo Map: (Mdr 16 length 212)
> Uncompressed size: 1.582.655 (0x18263e) , compressed: 1029077
> (0x0fb3d5)
> Frequencies of the tree nodes:
>
> '' 0x3 freq: 1 (0x1)
> '%' 0x25 freq: 1 (0x1)
> ':' 0x3a freq: 1 (0x1)


_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list