From 2702544d3f08132eeb481032df00728f3c429fe5 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Wed, 29 Jan 2014 23:27:53 +0530 Subject: [PATCH] Scale default compression buffer size for levels > 8. --- pcompress.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pcompress.c b/pcompress.c index 94c557e..8ef3f1d 100644 --- a/pcompress.c +++ b/pcompress.c @@ -2819,7 +2819,7 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[]) pctx->level = -1; err = 0; pctx->keylen = DEFAULT_KEYLEN; - pctx->chunksize = DEFAULT_CHUNKSIZE; + pctx->chunksize = 0; pos = argv[0] + strlen(argv[0]); while (*pos != '/' && pos > argv[0]) pos--; if (*pos == '/') pos++; @@ -3296,6 +3296,13 @@ init_pc_context(pc_ctx_t *pctx, int argc, char *argv[]) if (pctx->lzp_preprocess || pctx->enable_delta2_encode || pctx->dispack_preprocess) { pctx->preprocess_mode = 1; } + if (pctx->chunksize == 0) { + if (pctx->level < 9) { + pctx->chunksize = DEFAULT_CHUNKSIZE; + } else { + pctx->chunksize = DEFAULT_CHUNKSIZE + (pctx->level - 8) * DEFAULT_CHUNKSIZE/4; + } + } } else if (pctx->do_uncompress) { struct filter_flags ff; /*