-
-
Notifications
You must be signed in to change notification settings - Fork 0
Table Test 0
cr88192 edited this page Nov 5, 2015
·
3 revisions
VLC coding for runs will follow a pattern:
Run Length B(1) (Prefix, Range, Extra): 257-264, 3- 10, 0 265-268, 11- 18, 1 269-272, 19- 34, 2 273-276, 35- 66, 3 277-280, 67-130, 4 281-284, 131-258, 5 285, 258|3-65538, 0|16
The type of length table used will depend on the block type.
- Fixed Huffman 2 and Dynamic Huffman 2 will use A.
- Fixed Huffman and Dynamic Huffman will used B.
- The encoding of symbol 285 will depend on the mode:
- Deflate Mode: 258, 0
- Deflate64 Mode: 3-65538, 16
- BTLZA Mode: 3-65538, 16
- Symbols beyond 285 are not used.
- The encoding of symbol 285 will depend on the mode:
Extended Runs 318-321, 1- 4, 0 322/323, 5- 8, 1 324/325, 9- 16, 2 326/327, 17- 32, 3 328/329, 33- 64, 4 330/331, 65- 128, 5 332/333, 129- 256, 6
More Generalized Form of this scheme:
VLCB (Prefix, Range, Extra): 0- 7, 0- 7, 0 8-11, 8- 15, 1 12-15, 16- 31, 2 16-19, 32- 63, 3 20-23, 64-127, 4 24-27, 128-255, 5 28-31, 256-511, 6 - 32-33, 512-1023, 7 34-35, 1024-2047, 8 ... VLC-VLN (Prefix, Range, Extra): 0/1, 0- 1, 0 (Zero Run) 2, 2- 3, 1 (Zero Run) 3, 4- 7, 2 (Zero Run) 4, 8- 15, 3 (Zero Run) 5, 16- 31, 4 (Zero Run) 6, 32- 63, 5 (Zero Run) 7, 64- 127, 6 (Value) 8, 128- 255, 7 (Value) 9, 256- 511, 8 10, 512- 1023, 9 11, 1024- 2047, 10 12, 2048- 4095, 11 13, 4096- 8191, 12 14, 8192-16383, 13 15, 16384-32767, 14 - 16, 32768- 65535, 15 17, 65536-131071, 16 18, 131072-262143, 17 ...
Some values and arguments may have the sign folded into the LSB:
- 0, -1, 1, -2, 2, -3, 3, -4, ...
To be filled in more once it stabilizes.
Basically, it uses a bit-at-a-time encoder, with a variable context size.
The context basically consists of the last N preceding bits, which is used as an index into a probabilities table. After encoding each bit, the context is shifted 1 bit and the encoded bit is added to the LSB (or MSB).
This context is masked by the context-size, namely ((1<<n)-1), weights. ="" =" Logically," range="max-min:" bound="(range"></n)-1),>>8)*weight.- Values above this point (rval > dval) will correspond to a logical 1 bit
- min=bound+1;
- weight=weight-(w>>5);
- Values less than or equal to this value will be interpreted as 0
- max=bound;
- weight=weight+((256-w)>>5);
For encoding:
- Write the high 8 bits to the output;
- WriteByte(min>>24);
- min=(min<<8); max=(max<<8)|255;
- min=(min<<8); max=(max<<8)|255;
- val=(val<<8)|ReadByte();