讨论:Deflate

/* Maximum value for memLevel in deflateInit2 */

  1. ifndef MAX_MEM_LEVEL
  2. ifdef MAXSEG_64K
  3. define MAX_MEM_LEVEL 3 //8modify by linhai 原来是8现在改成3
  4. else
  5. define MAX_MEM_LEVEL 3 //9modify by linhai 原来是9现在改成3
  6. endif
  7. endif

/* Maximum value for windowBits in deflateInit2 and inflateInit2 */

  1. ifndef MAX_WBITS
  2. define MAX_WBITS 10 //15 modify by linhai 原来是15现在改成10 /* 32K LZ77 window */
  3. endif

/* The memory requirements for deflate are (in bytes):

           1 << (windowBits+2)   +  1 << (memLevel+9)
that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
    make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
  The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
  • /

由于内存问题,我把上面两个值改小了,经过测试,也可以生成压缩文件,但心里总是有点担心.由于对这个类不大熟悉,希望有高手指点. 同时,sizeof(deflate) 它的大小是5K多,对我来说,这个大小也挺大,有没有办法把大小减小.

发起有关Deflate的讨论

发起讨论
返回到“Deflate”页面。