lzham_lzdecompbase.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // File: lzham_lzdecompbase.h
  2. // See Copyright Notice and license at the end of include/lzham.h
  3. #pragma once
  4. //#define LZHAM_LZDEBUG
  5. #define LZHAM_IS_MATCH_MODEL_INDEX(cur_state) (cur_state)
  6. namespace lzham
  7. {
  8. struct table_update_settings
  9. {
  10. uint16 m_max_update_interval;
  11. uint16 m_slow_rate;
  12. };
  13. extern table_update_settings g_table_update_settings[];
  14. struct CLZDecompBase
  15. {
  16. enum
  17. {
  18. cMinMatchLen = 2U,
  19. cMaxMatchLen = 257U,
  20. cMaxHugeMatchLen = 65536,
  21. cMinDictSizeLog2 = 15,
  22. cMaxDictSizeLog2 = 29,
  23. cMatchHistSize = 4,
  24. cMaxLen2MatchDist = 2047
  25. };
  26. enum
  27. {
  28. cLZXNumSecondaryLengths = 249,
  29. cNumHugeMatchCodes = 1,
  30. cMaxHugeMatchCodeBits = 16,
  31. cLZXNumSpecialLengths = 2,
  32. cLZXLowestUsableMatchSlot = 1,
  33. cLZXMaxPositionSlots = 128
  34. };
  35. enum
  36. {
  37. cLZXSpecialCodeEndOfBlockCode = 0,
  38. cLZXSpecialCodePartialStateReset = 1
  39. };
  40. enum
  41. {
  42. cLZHAMDebugSyncMarkerValue = 666,
  43. cLZHAMDebugSyncMarkerBits = 12
  44. };
  45. enum
  46. {
  47. cBlockHeaderBits = 2,
  48. cBlockCheckBits = 4,
  49. cBlockFlushTypeBits = 2,
  50. cSyncBlock = 0,
  51. cCompBlock = 1,
  52. cRawBlock = 2,
  53. cEOFBlock = 3
  54. };
  55. enum
  56. {
  57. cNumStates = 12,
  58. cNumLitStates = 7,
  59. };
  60. uint m_dict_size_log2;
  61. uint m_dict_size;
  62. uint m_num_lzx_slots;
  63. static uint m_lzx_position_base[cLZXMaxPositionSlots];
  64. static uint m_lzx_position_extra_mask[cLZXMaxPositionSlots];
  65. static uint8 m_lzx_position_extra_bits[cLZXMaxPositionSlots];
  66. void init_position_slots(uint dict_size_log2);
  67. };
  68. } // namespace lzham