Changeset 148
- Timestamp:
- 06/08/10 04:01:54 (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
bench/bench.c (modified) (2 diffs)
-
src/blosc.c (modified) (2 diffs)
-
src/blosc.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bench/bench.c
r147 r148 164 164 memcpy(srccpy, src, size); 165 165 for (j = 0; j < nchunks; j++) { 166 /* 16 additional bytes should be enough for encoding everything */ 167 dest[j] = malloc(size+16); 166 dest[j] = malloc(size+BLOSC_MAX_OVERHEAD); 168 167 } 169 168 … … 212 211 for (j = 0; j < nchunks; j++) { 213 212 cbytes = blosc_compress(clevel, doshuffle, elsize, size, src, 214 dest[j], size );213 dest[j], size+BLOSC_MAX_OVERHEAD); 215 214 } 216 215 } -
trunk/src/blosc.c
r147 r148 612 612 613 613 /* Last chance for fitting `src` buffer in `dest` */ 614 if ((ntbytes == 0) && (nbytes+ 16<= maxbytes)) {614 if ((ntbytes == 0) && (nbytes+BLOSC_MAX_OVERHEAD <= maxbytes)) { 615 615 /* Specify that this buffer is memcpy'ed (bit 2 set to 1 in flags) */ 616 616 _dest = (uint8_t *)(dest); 617 617 _dest[2] = 0x2; 618 memcpy(dest+ 16, src, nbytes);619 ntbytes = nbytes+ 16;618 memcpy(dest+BLOSC_MAX_OVERHEAD, src, nbytes); 619 ntbytes = nbytes+BLOSC_MAX_OVERHEAD; 620 620 } 621 621 … … 657 657 /* Check whether this buffer is memcpy'ed */ 658 658 if (flags == 0x2) { 659 memcpy(dest, src+ 16, nbytes);659 memcpy(dest, src+BLOSC_MAX_OVERHEAD, nbytes); 660 660 return nbytes; 661 661 } -
trunk/src/blosc.h
r147 r148 27 27 #define BLOSC_VERSION_CFORMAT (BLOSC_VERSION_FORMAT << 8) & (BLOSCLZ_VERSION_FORMAT) 28 28 29 /* The maximum overhead during compression in bytes */ 30 #define BLOSC_MAX_OVERHEAD 16 29 31 30 32 /** … … 58 60 59 61 The `dest` buffer must have at least the size of `maxbytes`. Blosc 60 guarantees that if you set `maxbytes` at least to `nbytes` + 16, the61 compression will always succeed. The `src` buffer and the `dest`62 buffer can not overlap.62 guarantees that if you set `maxbytes` to, at least, 63 (`nbytes`+BLOSC_MAX_OVERHEAD), the compression will always succeed. 64 The `src` buffer and the `dest` buffer can not overlap. 63 65 64 66 If `src` buffer cannot be compressed into `maxbytes`, the return
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/images/blosc-logo-small.png)