// AUTOGENERATED FILE. DO NOT MODIFY.

#include <stdlib.h>
#include <stdint.h>

#include "unpack9.h"



static void unpack_1_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);
}

static void unpack_1_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 1 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 9 bits of data.
	// Input must be at least 2 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 18 bits of data.
	// Input must be at least 3 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 18 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);
}

static void unpack_2_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 2 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 18 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 27 bits of data.
	// Input must be at least 4 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 27 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 27 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 27 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);
}

static void unpack_3_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 3 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 27 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 36 bits of data.
	// Input must be at least 5 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);
}

static void unpack_4_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 4 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 36 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 45 bits of data.
	// Input must be at least 6 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);
}

static void unpack_5_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 5 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 45 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 54 bits of data.
	// Input must be at least 7 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);
}

static void unpack_6_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 6 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 54 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 63 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 54 to 62
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfe) << 22);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 63 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 54 to 62
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfe) << 22);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 63 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 55 to 63
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 63 bits of data.
	// Input must be at least 8 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 55 to 63
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 56 to 64
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)(input[8] & 0x80) << 16);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 56 to 64
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)(input[8] & 0x80) << 16);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 57 to 65
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0xc0) << 17);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 57 to 65
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0xc0) << 17);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 58 to 66
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xe0) << 18);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 58 to 66
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xe0) << 18);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 59 to 67
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xf0) << 19);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 59 to 67
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xf0) << 19);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 60 to 68
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf8) << 20);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 60 to 68
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf8) << 20);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 61 to 69
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xfc) << 21);
	output[6] = (double)(value >> 23);
}

static void unpack_7_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 7 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 63 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 61 to 69
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xfc) << 21);
	output[6] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 0 bits, read 72 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 54 to 62
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfe) << 22);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 63 to 71
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)input[8] << 23);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_0off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 0 bits, read 72 bits of data.
	// Input must be at least 9 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 0 to 8
	value = ((uint32_t)input[0] << 24) |
			((uint32_t)(input[1] & 0x80) << 16);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 9 to 17
	value = ((uint32_t)(input[1] & 0x7f) << 25) |
			((uint32_t)(input[2] & 0xc0) << 17);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 18 to 26
	value = ((uint32_t)(input[2] & 0x3f) << 26) |
			((uint32_t)(input[3] & 0xe0) << 18);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 27 to 35
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)(input[4] & 0xf0) << 19);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 36 to 44
	value = ((uint32_t)(input[4] & 0x0f) << 28) |
			((uint32_t)(input[5] & 0xf8) << 20);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 45 to 53
	value = ((uint32_t)(input[5] & 0x07) << 29) |
			((uint32_t)(input[6] & 0xfc) << 21);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 54 to 62
	value = ((uint32_t)(input[6] & 0x03) << 30) |
			((uint32_t)(input[7] & 0xfe) << 22);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 63 to 71
	value = ((uint32_t)(input[7] & 0x01) << 31) |
			((uint32_t)input[8] << 23);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 1 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 55 to 63
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 64 to 72
	value = ((uint32_t)input[8] << 24) |
			((uint32_t)(input[9] & 0x80) << 16);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_1off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 1 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 1 to 9
	value = ((uint32_t)(input[0] & 0x7f) << 25) |
			((uint32_t)(input[1] & 0xc0) << 17);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 10 to 18
	value = ((uint32_t)(input[1] & 0x3f) << 26) |
			((uint32_t)(input[2] & 0xe0) << 18);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 19 to 27
	value = ((uint32_t)(input[2] & 0x1f) << 27) |
			((uint32_t)(input[3] & 0xf0) << 19);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 28 to 36
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)(input[4] & 0xf8) << 20);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 37 to 45
	value = ((uint32_t)(input[4] & 0x07) << 29) |
			((uint32_t)(input[5] & 0xfc) << 21);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 46 to 54
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)(input[6] & 0xfe) << 22);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 55 to 63
	value = ((uint32_t)(input[6] & 0x01) << 31) |
			((uint32_t)input[7] << 23);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 64 to 72
	value = ((uint32_t)input[8] << 24) |
			((uint32_t)(input[9] & 0x80) << 16);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 2 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 56 to 64
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)(input[8] & 0x80) << 16);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 65 to 73
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0xc0) << 17);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_2off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 2 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 2 to 10
	value = ((uint32_t)(input[0] & 0x3f) << 26) |
			((uint32_t)(input[1] & 0xe0) << 18);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 11 to 19
	value = ((uint32_t)(input[1] & 0x1f) << 27) |
			((uint32_t)(input[2] & 0xf0) << 19);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 20 to 28
	value = ((uint32_t)(input[2] & 0x0f) << 28) |
			((uint32_t)(input[3] & 0xf8) << 20);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 29 to 37
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)(input[4] & 0xfc) << 21);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 38 to 46
	value = ((uint32_t)(input[4] & 0x03) << 30) |
			((uint32_t)(input[5] & 0xfe) << 22);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 47 to 55
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 56 to 64
	value = ((uint32_t)input[7] << 24) |
			((uint32_t)(input[8] & 0x80) << 16);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 65 to 73
	value = ((uint32_t)(input[8] & 0x7f) << 25) |
			((uint32_t)(input[9] & 0xc0) << 17);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 3 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 57 to 65
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0xc0) << 17);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 66 to 74
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xe0) << 18);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_3off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 3 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 3 to 11
	value = ((uint32_t)(input[0] & 0x1f) << 27) |
			((uint32_t)(input[1] & 0xf0) << 19);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 12 to 20
	value = ((uint32_t)(input[1] & 0x0f) << 28) |
			((uint32_t)(input[2] & 0xf8) << 20);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 21 to 29
	value = ((uint32_t)(input[2] & 0x07) << 29) |
			((uint32_t)(input[3] & 0xfc) << 21);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 30 to 38
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)(input[4] & 0xfe) << 22);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 39 to 47
	value = ((uint32_t)(input[4] & 0x01) << 31) |
			((uint32_t)input[5] << 23);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 48 to 56
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)(input[7] & 0x80) << 16);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 57 to 65
	value = ((uint32_t)(input[7] & 0x7f) << 25) |
			((uint32_t)(input[8] & 0xc0) << 17);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 66 to 74
	value = ((uint32_t)(input[8] & 0x3f) << 26) |
			((uint32_t)(input[9] & 0xe0) << 18);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 4 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 58 to 66
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xe0) << 18);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 67 to 75
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xf0) << 19);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_4off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 4 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 4 to 12
	value = ((uint32_t)(input[0] & 0x0f) << 28) |
			((uint32_t)(input[1] & 0xf8) << 20);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 13 to 21
	value = ((uint32_t)(input[1] & 0x07) << 29) |
			((uint32_t)(input[2] & 0xfc) << 21);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 22 to 30
	value = ((uint32_t)(input[2] & 0x03) << 30) |
			((uint32_t)(input[3] & 0xfe) << 22);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 31 to 39
	value = ((uint32_t)(input[3] & 0x01) << 31) |
			((uint32_t)input[4] << 23);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 40 to 48
	value = ((uint32_t)input[5] << 24) |
			((uint32_t)(input[6] & 0x80) << 16);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 49 to 57
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)(input[7] & 0xc0) << 17);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 58 to 66
	value = ((uint32_t)(input[7] & 0x3f) << 26) |
			((uint32_t)(input[8] & 0xe0) << 18);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 67 to 75
	value = ((uint32_t)(input[8] & 0x1f) << 27) |
			((uint32_t)(input[9] & 0xf0) << 19);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 5 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 59 to 67
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xf0) << 19);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 68 to 76
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf8) << 20);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_5off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 5 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 5 to 13
	value = ((uint32_t)(input[0] & 0x07) << 29) |
			((uint32_t)(input[1] & 0xfc) << 21);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 14 to 22
	value = ((uint32_t)(input[1] & 0x03) << 30) |
			((uint32_t)(input[2] & 0xfe) << 22);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 23 to 31
	value = ((uint32_t)(input[2] & 0x01) << 31) |
			((uint32_t)input[3] << 23);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 32 to 40
	value = ((uint32_t)input[4] << 24) |
			((uint32_t)(input[5] & 0x80) << 16);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 41 to 49
	value = ((uint32_t)(input[5] & 0x7f) << 25) |
			((uint32_t)(input[6] & 0xc0) << 17);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 50 to 58
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)(input[7] & 0xe0) << 18);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 59 to 67
	value = ((uint32_t)(input[7] & 0x1f) << 27) |
			((uint32_t)(input[8] & 0xf0) << 19);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 68 to 76
	value = ((uint32_t)(input[8] & 0x0f) << 28) |
			((uint32_t)(input[9] & 0xf8) << 20);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 6 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 60 to 68
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf8) << 20);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 69 to 77
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xfc) << 21);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_6off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 6 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 6 to 14
	value = ((uint32_t)(input[0] & 0x03) << 30) |
			((uint32_t)(input[1] & 0xfe) << 22);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 15 to 23
	value = ((uint32_t)(input[1] & 0x01) << 31) |
			((uint32_t)input[2] << 23);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 24 to 32
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)(input[4] & 0x80) << 16);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 33 to 41
	value = ((uint32_t)(input[4] & 0x7f) << 25) |
			((uint32_t)(input[5] & 0xc0) << 17);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 42 to 50
	value = ((uint32_t)(input[5] & 0x3f) << 26) |
			((uint32_t)(input[6] & 0xe0) << 18);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 51 to 59
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)(input[7] & 0xf0) << 19);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 60 to 68
	value = ((uint32_t)(input[7] & 0x0f) << 28) |
			((uint32_t)(input[8] & 0xf8) << 20);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 69 to 77
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)(input[9] & 0xfc) << 21);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_signed_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit signed
	// Skip 7 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	int32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 61 to 69
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xfc) << 21);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 70 to 78
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfe) << 22);
	output[7] = (double)(value >> 23);
}

static void unpack_8_9bit_unsigned_7off(const uint8_t * input, double * output, void *closure) {
	// Unpack 8 values into output
	// Values are 9-bit unsigned
	// Skip 7 bits, read 72 bits of data.
	// Input must be at least 10 bytes long

	(void)closure; // suppress unused parameter warning

	uint32_t value;

	// read output[0]: from bit 7 to 15
	value = ((uint32_t)(input[0] & 0x01) << 31) |
			((uint32_t)input[1] << 23);
	output[0] = (double)(value >> 23);

	// read output[1]: from bit 16 to 24
	value = ((uint32_t)input[2] << 24) |
			((uint32_t)(input[3] & 0x80) << 16);
	output[1] = (double)(value >> 23);

	// read output[2]: from bit 25 to 33
	value = ((uint32_t)(input[3] & 0x7f) << 25) |
			((uint32_t)(input[4] & 0xc0) << 17);
	output[2] = (double)(value >> 23);

	// read output[3]: from bit 34 to 42
	value = ((uint32_t)(input[4] & 0x3f) << 26) |
			((uint32_t)(input[5] & 0xe0) << 18);
	output[3] = (double)(value >> 23);

	// read output[4]: from bit 43 to 51
	value = ((uint32_t)(input[5] & 0x1f) << 27) |
			((uint32_t)(input[6] & 0xf0) << 19);
	output[4] = (double)(value >> 23);

	// read output[5]: from bit 52 to 60
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)(input[7] & 0xf8) << 20);
	output[5] = (double)(value >> 23);

	// read output[6]: from bit 61 to 69
	value = ((uint32_t)(input[7] & 0x07) << 29) |
			((uint32_t)(input[8] & 0xfc) << 21);
	output[6] = (double)(value >> 23);

	// read output[7]: from bit 70 to 78
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)(input[9] & 0xfe) << 22);
	output[7] = (double)(value >> 23);
}


unpack_func_t unpack_9bit[UNPACK_9BIT_MAX_COUNT][8][2] = {
	{
		{
			unpack_1_9bit_unsigned_0off,
			unpack_1_9bit_signed_0off,
		},
		{
			unpack_1_9bit_unsigned_1off,
			unpack_1_9bit_signed_1off,
		},
		{
			unpack_1_9bit_unsigned_2off,
			unpack_1_9bit_signed_2off,
		},
		{
			unpack_1_9bit_unsigned_3off,
			unpack_1_9bit_signed_3off,
		},
		{
			unpack_1_9bit_unsigned_4off,
			unpack_1_9bit_signed_4off,
		},
		{
			unpack_1_9bit_unsigned_5off,
			unpack_1_9bit_signed_5off,
		},
		{
			unpack_1_9bit_unsigned_6off,
			unpack_1_9bit_signed_6off,
		},
		{
			unpack_1_9bit_unsigned_7off,
			unpack_1_9bit_signed_7off,
		},
	},
	{
		{
			unpack_2_9bit_unsigned_0off,
			unpack_2_9bit_signed_0off,
		},
		{
			unpack_2_9bit_unsigned_1off,
			unpack_2_9bit_signed_1off,
		},
		{
			unpack_2_9bit_unsigned_2off,
			unpack_2_9bit_signed_2off,
		},
		{
			unpack_2_9bit_unsigned_3off,
			unpack_2_9bit_signed_3off,
		},
		{
			unpack_2_9bit_unsigned_4off,
			unpack_2_9bit_signed_4off,
		},
		{
			unpack_2_9bit_unsigned_5off,
			unpack_2_9bit_signed_5off,
		},
		{
			unpack_2_9bit_unsigned_6off,
			unpack_2_9bit_signed_6off,
		},
		{
			unpack_2_9bit_unsigned_7off,
			unpack_2_9bit_signed_7off,
		},
	},
	{
		{
			unpack_3_9bit_unsigned_0off,
			unpack_3_9bit_signed_0off,
		},
		{
			unpack_3_9bit_unsigned_1off,
			unpack_3_9bit_signed_1off,
		},
		{
			unpack_3_9bit_unsigned_2off,
			unpack_3_9bit_signed_2off,
		},
		{
			unpack_3_9bit_unsigned_3off,
			unpack_3_9bit_signed_3off,
		},
		{
			unpack_3_9bit_unsigned_4off,
			unpack_3_9bit_signed_4off,
		},
		{
			unpack_3_9bit_unsigned_5off,
			unpack_3_9bit_signed_5off,
		},
		{
			unpack_3_9bit_unsigned_6off,
			unpack_3_9bit_signed_6off,
		},
		{
			unpack_3_9bit_unsigned_7off,
			unpack_3_9bit_signed_7off,
		},
	},
	{
		{
			unpack_4_9bit_unsigned_0off,
			unpack_4_9bit_signed_0off,
		},
		{
			unpack_4_9bit_unsigned_1off,
			unpack_4_9bit_signed_1off,
		},
		{
			unpack_4_9bit_unsigned_2off,
			unpack_4_9bit_signed_2off,
		},
		{
			unpack_4_9bit_unsigned_3off,
			unpack_4_9bit_signed_3off,
		},
		{
			unpack_4_9bit_unsigned_4off,
			unpack_4_9bit_signed_4off,
		},
		{
			unpack_4_9bit_unsigned_5off,
			unpack_4_9bit_signed_5off,
		},
		{
			unpack_4_9bit_unsigned_6off,
			unpack_4_9bit_signed_6off,
		},
		{
			unpack_4_9bit_unsigned_7off,
			unpack_4_9bit_signed_7off,
		},
	},
	{
		{
			unpack_5_9bit_unsigned_0off,
			unpack_5_9bit_signed_0off,
		},
		{
			unpack_5_9bit_unsigned_1off,
			unpack_5_9bit_signed_1off,
		},
		{
			unpack_5_9bit_unsigned_2off,
			unpack_5_9bit_signed_2off,
		},
		{
			unpack_5_9bit_unsigned_3off,
			unpack_5_9bit_signed_3off,
		},
		{
			unpack_5_9bit_unsigned_4off,
			unpack_5_9bit_signed_4off,
		},
		{
			unpack_5_9bit_unsigned_5off,
			unpack_5_9bit_signed_5off,
		},
		{
			unpack_5_9bit_unsigned_6off,
			unpack_5_9bit_signed_6off,
		},
		{
			unpack_5_9bit_unsigned_7off,
			unpack_5_9bit_signed_7off,
		},
	},
	{
		{
			unpack_6_9bit_unsigned_0off,
			unpack_6_9bit_signed_0off,
		},
		{
			unpack_6_9bit_unsigned_1off,
			unpack_6_9bit_signed_1off,
		},
		{
			unpack_6_9bit_unsigned_2off,
			unpack_6_9bit_signed_2off,
		},
		{
			unpack_6_9bit_unsigned_3off,
			unpack_6_9bit_signed_3off,
		},
		{
			unpack_6_9bit_unsigned_4off,
			unpack_6_9bit_signed_4off,
		},
		{
			unpack_6_9bit_unsigned_5off,
			unpack_6_9bit_signed_5off,
		},
		{
			unpack_6_9bit_unsigned_6off,
			unpack_6_9bit_signed_6off,
		},
		{
			unpack_6_9bit_unsigned_7off,
			unpack_6_9bit_signed_7off,
		},
	},
	{
		{
			unpack_7_9bit_unsigned_0off,
			unpack_7_9bit_signed_0off,
		},
		{
			unpack_7_9bit_unsigned_1off,
			unpack_7_9bit_signed_1off,
		},
		{
			unpack_7_9bit_unsigned_2off,
			unpack_7_9bit_signed_2off,
		},
		{
			unpack_7_9bit_unsigned_3off,
			unpack_7_9bit_signed_3off,
		},
		{
			unpack_7_9bit_unsigned_4off,
			unpack_7_9bit_signed_4off,
		},
		{
			unpack_7_9bit_unsigned_5off,
			unpack_7_9bit_signed_5off,
		},
		{
			unpack_7_9bit_unsigned_6off,
			unpack_7_9bit_signed_6off,
		},
		{
			unpack_7_9bit_unsigned_7off,
			unpack_7_9bit_signed_7off,
		},
	},
	{
		{
			unpack_8_9bit_unsigned_0off,
			unpack_8_9bit_signed_0off,
		},
		{
			unpack_8_9bit_unsigned_1off,
			unpack_8_9bit_signed_1off,
		},
		{
			unpack_8_9bit_unsigned_2off,
			unpack_8_9bit_signed_2off,
		},
		{
			unpack_8_9bit_unsigned_3off,
			unpack_8_9bit_signed_3off,
		},
		{
			unpack_8_9bit_unsigned_4off,
			unpack_8_9bit_signed_4off,
		},
		{
			unpack_8_9bit_unsigned_5off,
			unpack_8_9bit_signed_5off,
		},
		{
			unpack_8_9bit_unsigned_6off,
			unpack_8_9bit_signed_6off,
		},
		{
			unpack_8_9bit_unsigned_7off,
			unpack_8_9bit_signed_7off,
		},
	},
};
