Leaked source code of windows server 2003
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.

79 lines
2.3 KiB

  1. /*
  2. * optenc.h
  3. *
  4. * Defines for the optimal encoder
  5. */
  6. // lookahead
  7. #define LOOK 1024
  8. // don't-care threshold for tree structure
  9. #define BREAK_LENGTH 50
  10. #define NUM_DIRECT_LOOKUP_TABLE_ELEMENTS 65536
  11. // see stdenc.h for comments on these values
  12. #define OPT_ENCODER_LIT_DIST_BUFFER_SIZE 65536
  13. #define OPT_ENCODER_MAX_ITEMS 65534
  14. //
  15. // For the optimal parser
  16. //
  17. typedef unsigned long numbits_t;
  18. typedef struct
  19. {
  20. ULONG link;
  21. ULONG path;
  22. numbits_t numbits;
  23. } t_decision_node;
  24. //
  25. // Optimal encoder context
  26. //
  27. typedef struct optimal_encoder
  28. {
  29. BYTE window[2*WINDOW_SIZE + MAX_MATCH + 4];
  30. t_decision_node decision_node[LOOK+MAX_MATCH+16];
  31. t_match_pos matchpos_table[MAX_MATCH+1];
  32. t_search_node search_left[2*WINDOW_SIZE];
  33. t_search_node search_right[2*WINDOW_SIZE];
  34. t_search_node search_tree_root[65536];
  35. // recording buffer for recording literals and distances
  36. BYTE lit_dist_buffer[OPT_ENCODER_LIT_DIST_BUFFER_SIZE];
  37. unsigned long recording_bitbuf;
  38. unsigned long recording_bitcount;
  39. BYTE * recording_bufptr;
  40. unsigned int next_tree_update;
  41. short recording_dist_tree_table[REC_DISTANCES_DECODING_TABLE_SIZE];
  42. short recording_dist_tree_left[2*MAX_DIST_TREE_ELEMENTS];
  43. short recording_dist_tree_right[2*MAX_DIST_TREE_ELEMENTS];
  44. BYTE recording_dist_tree_len[MAX_DIST_TREE_ELEMENTS];
  45. USHORT recording_dist_tree_code[MAX_DIST_TREE_ELEMENTS];
  46. short recording_literal_tree_table[REC_LITERALS_DECODING_TABLE_SIZE];
  47. short recording_literal_tree_left[2*MAX_LITERAL_TREE_ELEMENTS];
  48. short recording_literal_tree_right[2*MAX_LITERAL_TREE_ELEMENTS];
  49. BYTE recording_literal_tree_len[MAX_LITERAL_TREE_ELEMENTS];
  50. USHORT recording_literal_tree_code[MAX_LITERAL_TREE_ELEMENTS];
  51. // literal trees
  52. unsigned short literal_tree_freq[2*MAX_LITERAL_TREE_ELEMENTS];
  53. unsigned short literal_tree_code[MAX_LITERAL_TREE_ELEMENTS];
  54. BYTE literal_tree_len[MAX_LITERAL_TREE_ELEMENTS];
  55. // dist trees
  56. unsigned short dist_tree_freq[2*MAX_DIST_TREE_ELEMENTS];
  57. unsigned short dist_tree_code[MAX_DIST_TREE_ELEMENTS];
  58. BYTE dist_tree_len[MAX_DIST_TREE_ELEMENTS];
  59. } t_optimal_encoder;