Modified lz4 code to create a fix for #73

- by default, 7-Zip ZS creates lz4 streams with skippable frames, cause this
  makes parallel decompression possible
- but: sometimes this feature is not needed or wanted
- this patch will skip the writing of the additional frames for lz4, when
  compressing single threaded (-mmt=1)
This commit is contained in:
Tino Reichardt
2019-03-04 20:15:18 +01:00
parent 5a0006bff8
commit b10fe5514f

View File

@@ -291,11 +291,13 @@ static void *pt_compress(void *arg)
}
/* write skippable frame */
MEM_writeLE32((unsigned char *)wl->out.buf + 0,
LZ4FMT_MAGIC_SKIPPABLE);
MEM_writeLE32((unsigned char *)wl->out.buf + 4, 4);
MEM_writeLE32((unsigned char *)wl->out.buf + 8, (U32) result);
wl->out.size = result + 12;
if (ctx->threads > 1) {
MEM_writeLE32((unsigned char *)wl->out.buf + 0,
LZ4FMT_MAGIC_SKIPPABLE);
MEM_writeLE32((unsigned char *)wl->out.buf + 4, 4);
MEM_writeLE32((unsigned char *)wl->out.buf + 8, (U32) result);
wl->out.size = result + 12;
}
/* write result */
pthread_mutex_lock(&ctx->write_mutex);