Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.0 KiB

  1. /*
  2. * common/compdefs.h
  3. *
  4. * Definitions for both encoder and decoder
  5. */
  6. /*
  7. * Smallest allowable match length
  8. */
  9. #define MIN_MATCH 2
  10. /*
  11. * Maximum match length
  12. */
  13. #define MAX_MATCH (MIN_MATCH+255)
  14. /*
  15. * Number of uncompressed symbols
  16. */
  17. #define NUM_CHARS 256
  18. /*
  19. * Number of match lengths which are correlated with match positions
  20. */
  21. #define NUM_PRIMARY_LENGTHS 7
  22. /*
  23. * Primary lengths plus the extension code
  24. */
  25. #define NUM_LENGTHS (NUM_PRIMARY_LENGTHS+1)
  26. /*
  27. * Equals number of different possible match lengths minus primary lengths
  28. */
  29. #define NUM_SECONDARY_LENGTHS ((MAX_MATCH-MIN_MATCH+1)-NUM_PRIMARY_LENGTHS)
  30. /* NL_SHIFT = log2(NUM_LENGTHS) */
  31. #define NL_SHIFT 3
  32. /*
  33. * Number of repeated offsets
  34. */
  35. #define NUM_REPEATED_OFFSETS 3
  36. /*
  37. * Number of elements in the aligned offset tree
  38. */
  39. #define ALIGNED_NUM_ELEMENTS 8
  40. /*
  41. * Repeat codes for outputting trees
  42. */
  43. /* Minimum number of repetitions of anything we're interested in */
  44. #define TREE_ENC_REP_MIN 4
  45. /* Maximum repetitions for "type A" repetition of zeroes */
  46. /* (min...min+REP_ZERO_FIRST) */
  47. #define TREE_ENC_REP_ZERO_FIRST 16
  48. /* Maximum repetitions for "type B" repetition of zeroes */
  49. /* (min+REP_ZERO_FIRST...min+REP_ZERO_FIRST+REP_ZERO_SECOND) */
  50. #define TREE_ENC_REP_ZERO_SECOND 32
  51. /* Maximum repetitions for "type C" repetition of anything */
  52. /* (min...min_REP_SAME_FIRST) */
  53. #define TREE_ENC_REP_SAME_FIRST 2
  54. /* Bits required to output the above numbers */
  55. #define TREE_ENC_REPZ_FIRST_EXTRA_BITS 4
  56. #define TREE_ENC_REPZ_SECOND_EXTRA_BITS 5
  57. #define TREE_ENC_REP_SAME_EXTRA_BITS 1
  58. /* Number of cfdata frames before E8's are turned off automatically */
  59. #define E8_CFDATA_FRAME_THRESHOLD 32768
  60. /*
  61. * Block types
  62. */
  63. typedef enum
  64. {
  65. BLOCKTYPE_INVALID = 0,
  66. BLOCKTYPE_VERBATIM = 1, /* normal block */
  67. BLOCKTYPE_ALIGNED = 2, /* aligned offset block */
  68. BLOCKTYPE_UNCOMPRESSED = 3 /* uncompressed block */
  69. } lzx_block_type;