| | 1 | | namespace ICSharpCode.SharpZipLib.Lzw |
| | 2 | | { |
| | 3 | | /// <summary> |
| | 4 | | /// This class contains constants used for LZW |
| | 5 | | /// </summary> |
| | 6 | | sealed public class LzwConstants |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Magic number found at start of LZW header: 0x1f 0x9d |
| | 10 | | /// </summary> |
| | 11 | | public const int MAGIC = 0x1f9d; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Maximum number of bits per code |
| | 15 | | /// </summary> |
| | 16 | | public const int MAX_BITS = 16; |
| | 17 | |
|
| | 18 | | /* 3rd header byte: |
| | 19 | | * bit 0..4 Number of compression bits |
| | 20 | | * bit 5 Extended header |
| | 21 | | * bit 6 Free |
| | 22 | | * bit 7 Block mode |
| | 23 | | */ |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Mask for 'number of compression bits' |
| | 27 | | /// </summary> |
| | 28 | | public const int BIT_MASK = 0x1f; |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Indicates the presence of a fourth header byte |
| | 32 | | /// </summary> |
| | 33 | | public const int EXTENDED_MASK = 0x20; |
| | 34 | | //public const int FREE_MASK = 0x40; |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Reserved bits |
| | 38 | | /// </summary> |
| | 39 | | public const int RESERVED_MASK = 0x60; |
| | 40 | |
|
| | 41 | | /// <summary> |
| | 42 | | /// Block compression: if table is full and compression rate is dropping, |
| | 43 | | /// clear the dictionary. |
| | 44 | | /// </summary> |
| | 45 | | public const int BLOCK_MODE_MASK = 0x80; |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// LZW file header size (in bytes) |
| | 49 | | /// </summary> |
| | 50 | | public const int HDR_SIZE = 3; |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Initial number of bits per code |
| | 54 | | /// </summary> |
| | 55 | | public const int INIT_BITS = 9; |
| | 56 | |
|
| 0 | 57 | | LzwConstants() |
| | 58 | | { |
| 0 | 59 | | } |
| | 60 | | } |
| | 61 | | } |