Changeset 146
- Timestamp:
- 06/07/10 08:04:42 (3 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
-
RELEASE_NOTES.txt (modified) (1 diff)
-
src/blosc.c (modified) (1 diff)
-
src/blosc.h (modified) (1 diff)
-
tests (added)
-
tests/Makefile (added)
-
tests/test_api.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/RELEASE_NOTES.txt
r145 r146 10 10 =========================== 11 11 12 - None yet. 12 - Added 3 new functions for querying different metadata on compressed 13 buffers. A test suite for testing the new API has been added too. 13 14 14 15 -
trunk/src/blosc.c
r141 r146 682 682 assert(ntbytes <= (int32_t)dest_size); 683 683 return ntbytes; 684 } 685 686 687 /* Return information about a compressed buffer, namely the number of 688 uncompressed bytes (`nbytes`) and compressed (`cbytes`). This 689 function should always succeed. */ 690 void blosc_cbuffer_sizes(const void *cbuffer, size_t *nbytes, 691 size_t *cbytes) 692 { 693 uint8_t *_src = (uint8_t *)(cbuffer); /* current pos for source buffer */ 694 uint8_t version, versionlz; /* versions for compressed header */ 695 696 /* Read the version info (could be useful in the future) */ 697 version = _src[0]; /* blosc format version */ 698 versionlz = _src[1]; /* blosclz format version */ 699 700 /* Read the interesting values */ 701 _src += 4; 702 *nbytes = (size_t)sw32(((uint32_t *)_src)[0]); /* buffer size */ 703 *cbytes = (size_t)sw32(((uint32_t *)_src)[2]); /* compressed buffer size */ 704 } 705 706 707 /* Return information about a compressed buffer, namely the type size 708 (`typesize`), and whether the shuffle filter has been applied or 709 not (`shuffle`). This function should always succeed. */ 710 void blosc_cbuffer_metainfo(const void *cbuffer, size_t *typesize, 711 int *shuffle) 712 { 713 uint8_t *_src = (uint8_t *)(cbuffer); /* current pos for source buffer */ 714 uint8_t version, versionlz; /* versions for compressed header */ 715 uint8_t flags; /* flags for header */ 716 717 /* Read the version info (could be useful in the future) */ 718 version = _src[0]; /* blosc format version */ 719 versionlz = _src[1]; /* blosclz format version */ 720 721 /* Read the interesting values */ 722 flags = _src[2]; /* flags */ 723 *typesize = (size_t)_src[3]; /* typesize */ 724 725 /* Shuffle info */ 726 if ((flags & 0x1) == 1) { 727 /* Input is shuffled. Unshuffle it. */ 728 *shuffle = 1; 729 } 730 else { 731 *shuffle = 0; 732 } 733 } 734 735 736 /* Return information about a compressed buffer, namely the internal 737 Blosc format version (`version`) and the format for the internal 738 Lempel-Ziv algorithm (`versionlz`). This function should always 739 succeed. */ 740 void blosc_cbuffer_versions(const void *cbuffer, int *version, 741 int *versionlz) 742 { 743 uint8_t *_src = (uint8_t *)(cbuffer); /* current pos for source buffer */ 744 745 /* Read the version info */ 746 *version = (int)(_src[0]); /* blosc format version */ 747 *versionlz = (int)(_src[1]); /* blosclz format version */ 684 748 } 685 749 -
trunk/src/blosc.h
r145 r146 109 109 110 110 111 /** 112 113 Return information about a compressed buffer, namely the number of 114 uncompressed bytes (`nbytes`) and compressed (`cbytes`). This 115 function should always succeed. 116 117 */ 118 119 void blosc_cbuffer_sizes(const void *cbuffer, size_t *nbytes, 120 size_t *cbytes); 121 122 123 /** 124 125 Return information about a compressed buffer, namely the type size 126 (`typesize`), and whether the shuffle filter has been applied or not 127 (`shuffle`). This function should always succeed. 128 129 */ 130 131 void blosc_cbuffer_metainfo(const void *cbuffer, size_t *typesize, 132 int *shuffle); 133 134 135 /** 136 137 Return information about a compressed buffer, namely the internal 138 Blosc format version (`version`) and the format for the internal 139 Lempel-Ziv algorithm (`versionlz`). This function should always 140 succeed. 141 142 */ 143 144 void blosc_cbuffer_versions(const void *cbuffer, int *version, 145 int *versionlz); 146 147 111 148 112 149 /*********************************************************************
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/images/blosc-logo-small.png)