casacore
|
Class for bit packing of values into bytes. More...
#include <bytepacker.h>
Static Public Member Functions | |
static void | pack (unsigned bitCount, unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Call a pack..() function for a given bit count. | |
static void | unpack (unsigned bitCount, unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Call an unpack..() function for a given bit count. | |
static void | pack2 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=2. | |
static void | unpack2 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack2(). | |
static void | pack3 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=3. | |
static void | unpack3 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack3(). | |
static void | pack4 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=4. | |
static void | unpack4 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack4(). | |
static void | pack6 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=6. | |
static void | unpack6 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack6(). | |
static void | pack8 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=8. | |
static void | unpack8 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack8(). | |
static void | pack10 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=10. | |
static void | unpack10 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack10(). | |
static void | pack12 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=12. | |
static void | unpack12 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack12(). | |
static void | pack16 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=16. | |
static void | unpack16 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack16(). | |
static size_t | bufferSize (size_t nSymbols, size_t nBits) |
Class for bit packing of values into bytes.
Contains several methods that can pack and unpack an array of unsigned values into a bit-packed array, using as few bytes as possible. The number of bits used is fixed for all values in the array. All methods assume that the specified output array has at least enough space to store the packed / unpacked data. When packing, the amount of space needed is ceil(symbolCount / bitCount).
The pack() and unpack() methods can call the method with given bitcount at runtime. If the bitcount is known at compile time, one of the other methods can be used. For each of these calls, the input symbols are assumed to occupy at most the given number of bits. The number of bytes written during pack operations is ceil(symbolCount * bitCount / 8). unpack operations will write symbolCount symbols into the output buffer.
Definition at line 26 of file bytepacker.h.
|
inlinestatic |
Definition at line 148 of file bytepacker.h.
|
inlinestatic |
Call a pack..() function for a given bit count.
Will forward the pack operation to the one for the given bit count.
bitCount | the number of bits to use per symbol |
dest | output buffer (see class desc for size) |
symbolBuffer | the input buffer |
symbolCount | number of symbols in symbolBuffer . |
Definition at line 153 of file bytepacker.h.
References pack10(), pack12(), pack16(), pack2(), pack3(), pack4(), pack6(), and pack8().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=10.
++symbolBuffer; ++pos;
Definition at line 567 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=12.
Definition at line 670 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=16.
Definition at line 718 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=2.
Definition at line 220 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=3.
Definition at line 286 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=4.
Definition at line 433 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=6.
++symbolBuffer; ++pos;
Definition at line 462 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=8.
Definition at line 556 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Call an unpack..() function for a given bit count.
Will forward the unpack operation to the one for the given bit count.
bitCount | the number of bits used per symbol |
symbolBuffer | output buffer |
packedBuffer | the input buffer with the packed symbols |
symbolCount | number of symbols that will be unpacked into symbolBuffer . |
Definition at line 186 of file bytepacker.h.
References unpack10(), unpack12(), unpack16(), unpack2(), unpack3(), unpack4(), unpack6(), and unpack8().
|
inlinestatic |
Reverse of pack10().
Will write symbolCount items into the symbolBuffer.
Definition at line 619 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack12().
Will write symbolCount items into the symbolBuffer.
Definition at line 695 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack16().
Will write symbolCount items into the symbolBuffer.
Definition at line 725 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack2().
Will write symbolCount items into the symbolBuffer.
Definition at line 253 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack3().
Will write symbolCount items into the symbolBuffer.
Definition at line 355 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack4().
Will write symbolCount items into the symbolBuffer.
Definition at line 447 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack6().
Will write symbolCount items into the symbolBuffer.
Definition at line 510 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack8().
Will write symbolCount items into the symbolBuffer.
Definition at line 561 of file bytepacker.h.
Referenced by unpack().