LzmaRam.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // LzmaRam.h
  2. #ifndef __LzmaRam_h
  3. #define __LzmaRam_h
  4. #include <stdlib.h>
  5. #include "../../../Common/Types.h"
  6. /*
  7. LzmaRamEncode: BCJ + LZMA RAM->RAM compressing.
  8. It uses .lzma format, but it writes one additional byte to .lzma file:
  9. 0: - no filter
  10. 1: - x86(BCJ) filter.
  11. To provide best compression ratio dictionarySize mustbe >= inSize
  12. LzmaRamEncode allocates Data with MyAlloc/BigAlloc functions.
  13. RAM Requirements:
  14. RamSize = dictionarySize * 9.5 + 6MB + FilterBlockSize
  15. FilterBlockSize = 0, if useFilter == false
  16. FilterBlockSize = inSize, if useFilter == true
  17. Return code:
  18. 0 - OK
  19. 1 - Unspecified Error
  20. 2 - Memory allocating error
  21. 3 - Output buffer OVERFLOW
  22. If you use SZ_FILTER_AUTO mode, then encoder will use 2 or 3 passes:
  23. 2 passes when FILTER_NO provides better compression.
  24. 3 passes when FILTER_YES provides better compression.
  25. */
  26. enum ESzFilterMode
  27. {
  28. SZ_FILTER_NO,
  29. SZ_FILTER_YES,
  30. SZ_FILTER_AUTO
  31. };
  32. int LzmaRamEncode(
  33. const Byte *inBuffer, size_t inSize,
  34. Byte *outBuffer, size_t outSize, size_t *outSizeProcessed,
  35. UInt32 dictionarySize, ESzFilterMode filterMode);
  36. #endif