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.

98 lines
2.3 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. Mrcf.h
  5. Abstract:
  6. This module defines all of the double space compression routines
  7. Author:
  8. Gary Kimura [GaryKi] 03-Jun-1993
  9. Revision History:
  10. --*/
  11. #ifndef _MRCF_
  12. #define _MRCF_
  13. //
  14. // To decompress/compress a block of data the user needs to
  15. // provide a work space as an extra parameter to all the exported
  16. // procedures. That way the routines will not need to use excessive
  17. // stack space and will still be multithread safe
  18. //
  19. //
  20. // Variables for reading and writing bits
  21. //
  22. typedef struct _MRCF_BIT_IO {
  23. USHORT abitsBB; // 16-bit buffer being read
  24. LONG cbitsBB; // Number of bits left in abitsBB
  25. PUCHAR pbBB; // Pointer to byte stream being read
  26. ULONG cbBB; // Number of bytes left in pbBB
  27. ULONG cbBBInitial; // Initial size of pbBB
  28. } MRCF_BIT_IO;
  29. typedef MRCF_BIT_IO *PMRCF_BIT_IO;
  30. //
  31. // Decompression only needs the bit i/o structure
  32. //
  33. typedef struct _MRCF_DECOMPRESS {
  34. MRCF_BIT_IO BitIo;
  35. } MRCF_DECOMPRESS;
  36. typedef MRCF_DECOMPRESS *PMRCF_DECOMPRESS;
  37. //
  38. // Standard compression uses a few more field to contain
  39. // the lookup table
  40. //
  41. #define cMAXSLOTS (8) // The maximum number of slots used in the algorithm
  42. #define ltUNUSED (0xE000) // Value of unused ltX table entry
  43. #define mruUNUSED (0xFF) // Value of unused MRU table entry
  44. #define bRARE (0xD5) // Rarely occuring character value
  45. typedef struct _MRCF_STANDARD_COMPRESS {
  46. MRCF_BIT_IO BitIo;
  47. ULONG ltX[256][cMAXSLOTS]; // Source text pointer look-up table
  48. UCHAR abChar[256][cMAXSLOTS]; // Character look-up table
  49. UCHAR abMRUX[256]; // Most Recently Used ltX/abChar entry
  50. } MRCF_STANDARD_COMPRESS;
  51. typedef MRCF_STANDARD_COMPRESS *PMRCF_STANDARD_COMPRESS;
  52. ULONG
  53. MrcfDecompress (
  54. PUCHAR UncompressedBuffer,
  55. ULONG UncompressedLength,
  56. PUCHAR CompressedBuffer,
  57. ULONG CompressedLength,
  58. PMRCF_DECOMPRESS WorkSpace
  59. );
  60. ULONG
  61. MrcfStandardCompress (
  62. PUCHAR CompressedBuffer,
  63. ULONG CompressedLength,
  64. PUCHAR UncompressedBuffer,
  65. ULONG UncompressedLength,
  66. PMRCF_STANDARD_COMPRESS WorkSpace
  67. );
  68. #endif // _MRCF_