
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@lists.mkgmap.org.uk> im Auftrag von Gerd Petermann <gpetermann_muenchen@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@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@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 On Thu, 2021-12-23 at 09:40 +0000, Gerd Petermann wrote:
Hi Ticker,
ouch, didn't even read that one :( Would have saved me a lot of time as my first idea was a "jump table". Attached is the new patch and the corrected mdr16 outputs produced with this patch.
So, besides the fields with ??? the only open question is the meaning of the struct bytes in the first table. I guess it will become clear when I try to use the lookup table in the decoder.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ticker Berkin <rwb-mkgmap@jagit.co.uk> Gesendet: Donnerstag, 23. Dezember 2021 09:31 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] [mkgmap-svn] Commit r572: MDR16 is some kind of codebook.
Hi Gerd
I guessed that it was the \0 that cut the file off.
You mean something like answer 5 here:
https://stackoverflow.com/questions/759707/efficient-way-of-storing-huffman-...
I looked at this earlier trying to work out if it was relevant but didn't make it fit - I should have tried harder.
I still haven't spotted anything to determine the length of the 2 /3 byte in before and in the struct for {length}
Ticker
On Thu, 2021-12-23 at 01:17 +0000, Gerd Petermann wrote:
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 | ???
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev