討論:Deflate
/* Maximum value for memLevel in deflateInit2 */
- ifndef MAX_MEM_LEVEL
- ifdef MAXSEG_64K
- define MAX_MEM_LEVEL 3 //8modify by linhai 原來是8現在改成3
- else
- define MAX_MEM_LEVEL 3 //9modify by linhai 原來是9現在改成3
- endif
- endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2 */
- ifndef MAX_WBITS
- define MAX_WBITS 10 //15 modify by linhai 原來是15現在改成10 /* 32K LZ77 window */
- 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多,對我來說,這個大小也挺大,有沒有辦法把大小減小.