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. More... | |
static void | unpack (unsigned bitCount, unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Call an unpack..() function for a given bit count. More... | |
static void | pack2 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=2. More... | |
static void | unpack2 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack2(). More... | |
static void | pack3 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=3. More... | |
static void | unpack3 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack3(). More... | |
static void | pack4 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=4. More... | |
static void | unpack4 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack4(). More... | |
static void | pack6 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=6. More... | |
static void | unpack6 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack6(). More... | |
static void | pack8 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=8. More... | |
static void | unpack8 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack8(). More... | |
static void | pack10 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=10. More... | |
static void | unpack10 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack10(). More... | |
static void | pack12 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=12. More... | |
static void | unpack12 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack12(). More... | |
static void | pack16 (unsigned char *dest, const unsigned *symbolBuffer, size_t symbolCount) |
Pack the symbols from symbolBuffer into the destination array using bitCount=16. More... | |
static void | unpack16 (unsigned *symbolBuffer, unsigned char *packedBuffer, size_t symbolCount) |
Reverse of pack16(). More... | |
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 25 of file bytepacker.h.
|
inlinestatic |
Definition at line 147 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 152 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 566 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=12.
Definition at line 669 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=16.
Definition at line 717 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=2.
Definition at line 219 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=3.
Definition at line 285 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=4.
Definition at line 432 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 461 of file bytepacker.h.
Referenced by pack().
|
inlinestatic |
Pack the symbols from symbolBuffer into the destination array using bitCount=8.
Definition at line 555 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 185 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 618 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack12().
Will write symbolCount items into the symbolBuffer.
Definition at line 694 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack16().
Will write symbolCount items into the symbolBuffer.
Definition at line 724 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack2().
Will write symbolCount items into the symbolBuffer.
Definition at line 252 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack3().
Will write symbolCount items into the symbolBuffer.
Definition at line 354 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack4().
Will write symbolCount items into the symbolBuffer.
Definition at line 446 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack6().
Will write symbolCount items into the symbolBuffer.
Definition at line 509 of file bytepacker.h.
Referenced by unpack().
|
inlinestatic |
Reverse of pack8().
Will write symbolCount items into the symbolBuffer.
Definition at line 560 of file bytepacker.h.
Referenced by unpack().