int64_t lzbench_blosclz_decompress(char *inbuf, size_t insize, char *outbuf, size_t outsize, size_t , size_t, char*) { return blosclz_decompress(inbuf, insize, outbuf, outsize); }
/* Decompress & unshuffle a single block */ static int blosc_d(uint32_t blocksize, int32_t leftoverblock, uint8_t *src, uint8_t *dest, uint8_t *tmp, uint8_t *tmp2) { int32_t j, neblock, nsplits; int32_t nbytes; /* number of decompressed bytes in split */ int32_t cbytes; /* number of compressed bytes in split */ int32_t ctbytes = 0; /* number of compressed bytes in block */ int32_t ntbytes = 0; /* number of uncompressed bytes in block */ uint8_t *_tmp; uint32_t typesize = params.typesize; if ((params.flags & BLOSC_DOSHUFFLE) && (typesize > 1)) { _tmp = tmp; } else { _tmp = dest; } /* Compress for each shuffled slice split for this block. */ if ((typesize <= MAX_SPLITS) && (blocksize/typesize) >= MIN_BUFFERSIZE && (!leftoverblock)) { nsplits = typesize; } else { nsplits = 1; } neblock = blocksize / nsplits; for (j = 0; j < nsplits; j++) { cbytes = sw32(((uint32_t *)(src))[0]); /* amount of compressed bytes */ src += sizeof(int32_t); ctbytes += sizeof(int32_t); /* Uncompress */ if (cbytes == neblock) { memcpy(_tmp, src, neblock); nbytes = neblock; } else { nbytes = blosclz_decompress(src, cbytes, _tmp, neblock); if (nbytes != neblock) { return -2; } } src += cbytes; ctbytes += cbytes; _tmp += nbytes; ntbytes += nbytes; } /* Closes j < nsplits */ if ((params.flags & BLOSC_DOSHUFFLE) && (typesize > 1)) { if ((uintptr_t)dest % 16 == 0) { /* 16-bytes aligned dest. SSE2 unshuffle will work. */ unshuffle(typesize, blocksize, tmp, dest); } else { /* dest is not aligned. Use tmp2, which is aligned, and copy. */ unshuffle(typesize, blocksize, tmp, tmp2); if (tmp2 != dest) { /* Copy only when dest is not tmp2 (e.g. not blosc_getitem()) */ memcpy(dest, tmp2, blocksize); } } } /* Return the number of uncompressed bytes */ return ntbytes; }