// AUTOGENERATED FILE. DO NOT MODIFY.

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

#include "unpack23.h"



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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

	uint32_t value;

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

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

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

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

	uint32_t value;

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

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

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);
}

static void unpack_4_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 4 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 92 bits of data.
	// Input must be at least 12 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);
}

static void unpack_4_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 4 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 92 bits of data.
	// Input must be at least 12 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);
}

static void unpack_5_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 5 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 115 bits of data.
	// Input must be at least 15 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);
}

static void unpack_5_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 5 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 115 bits of data.
	// Input must be at least 15 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);
}

static void unpack_10_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 230 bits of data.
	// Input must be at least 29 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);
}

static void unpack_10_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 10 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 230 bits of data.
	// Input must be at least 29 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 253 bits of data.
	// Input must be at least 32 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);
}

static void unpack_11_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 11 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 253 bits of data.
	// Input must be at least 33 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);
}

static void unpack_12_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);
}

static void unpack_12_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 12 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 276 bits of data.
	// Input must be at least 35 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 299 bits of data.
	// Input must be at least 38 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 299 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 299 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 299 bits of data.
	// Input must be at least 39 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);
}

static void unpack_13_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 13 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 299 bits of data.
	// Input must be at least 39 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 322 bits of data.
	// Input must be at least 41 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 322 bits of data.
	// Input must be at least 42 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);
}

static void unpack_14_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 14 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 322 bits of data.
	// Input must be at least 42 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);
}

static void unpack_15_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 15 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 345 bits of data.
	// Input must be at least 44 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 368 bits of data.
	// Input must be at least 46 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 368 bits of data.
	// Input must be at least 46 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);
}

static void unpack_16_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 16 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 368 bits of data.
	// Input must be at least 47 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 391 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 391 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 391 bits of data.
	// Input must be at least 49 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 391 bits of data.
	// Input must be at least 49 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);
}

static void unpack_17_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 17 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 391 bits of data.
	// Input must be at least 50 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);
}

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

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);
}

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

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 437 bits of data.
	// Input must be at least 55 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);
}

static void unpack_19_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 19 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 437 bits of data.
	// Input must be at least 56 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 460 bits of data.
	// Input must be at least 58 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);
}

static void unpack_20_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 20 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 460 bits of data.
	// Input must be at least 59 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 460 to 482
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)input[58] << 20) |
			((uint32_t)input[59] << 12) |
			((uint32_t)(input[60] & 0xe0) << 4);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 460 to 482
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)input[58] << 20) |
			((uint32_t)input[59] << 12) |
			((uint32_t)(input[60] & 0xe0) << 4);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 461 to 483
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)input[58] << 21) |
			((uint32_t)input[59] << 13) |
			((uint32_t)(input[60] & 0xf0) << 5);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 461 to 483
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)input[58] << 21) |
			((uint32_t)input[59] << 13) |
			((uint32_t)(input[60] & 0xf0) << 5);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 462 to 484
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)input[58] << 22) |
			((uint32_t)input[59] << 14) |
			((uint32_t)(input[60] & 0xf8) << 6);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 462 to 484
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)input[58] << 22) |
			((uint32_t)input[59] << 14) |
			((uint32_t)(input[60] & 0xf8) << 6);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 463 to 485
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)input[58] << 23) |
			((uint32_t)input[59] << 15) |
			((uint32_t)(input[60] & 0xfc) << 7);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 463 to 485
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)input[58] << 23) |
			((uint32_t)input[59] << 15) |
			((uint32_t)(input[60] & 0xfc) << 7);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 464 to 486
	value = ((uint32_t)input[58] << 24) |
			((uint32_t)input[59] << 16) |
			((uint32_t)(input[60] & 0xfe) << 8);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 464 to 486
	value = ((uint32_t)input[58] << 24) |
			((uint32_t)input[59] << 16) |
			((uint32_t)(input[60] & 0xfe) << 8);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 465 to 487
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)input[59] << 17) |
			((uint32_t)input[60] << 9);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 483 bits of data.
	// Input must be at least 61 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 465 to 487
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)input[59] << 17) |
			((uint32_t)input[60] << 9);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 483 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 466 to 488
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)input[59] << 18) |
			((uint32_t)input[60] << 10) |
			((uint32_t)(input[61] & 0x80) << 2);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 483 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 466 to 488
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)input[59] << 18) |
			((uint32_t)input[60] << 10) |
			((uint32_t)(input[61] & 0x80) << 2);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 483 bits of data.
	// Input must be at least 62 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 467 to 489
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)input[59] << 19) |
			((uint32_t)input[60] << 11) |
			((uint32_t)(input[61] & 0xc0) << 3);
	output[20] = (double)(value >> 9);
}

static void unpack_21_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 21 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 483 bits of data.
	// Input must be at least 62 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 467 to 489
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)input[59] << 19) |
			((uint32_t)input[60] << 11) |
			((uint32_t)(input[61] & 0xc0) << 3);
	output[20] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_0off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 0 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 460 to 482
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)input[58] << 20) |
			((uint32_t)input[59] << 12) |
			((uint32_t)(input[60] & 0xe0) << 4);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 483 to 505
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)input[61] << 19) |
			((uint32_t)input[62] << 11) |
			((uint32_t)(input[63] & 0xc0) << 3);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_0off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 0 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 46 to 68
	value = ((uint32_t)(input[5] & 0x03) << 30) |
			((uint32_t)input[6] << 22) |
			((uint32_t)input[7] << 14) |
			((uint32_t)(input[8] & 0xf8) << 6);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 69 to 91
	value = ((uint32_t)(input[8] & 0x07) << 29) |
			((uint32_t)input[9] << 21) |
			((uint32_t)input[10] << 13) |
			((uint32_t)(input[11] & 0xf0) << 5);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 92 to 114
	value = ((uint32_t)(input[11] & 0x0f) << 28) |
			((uint32_t)input[12] << 20) |
			((uint32_t)input[13] << 12) |
			((uint32_t)(input[14] & 0xe0) << 4);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 115 to 137
	value = ((uint32_t)(input[14] & 0x1f) << 27) |
			((uint32_t)input[15] << 19) |
			((uint32_t)input[16] << 11) |
			((uint32_t)(input[17] & 0xc0) << 3);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 138 to 160
	value = ((uint32_t)(input[17] & 0x3f) << 26) |
			((uint32_t)input[18] << 18) |
			((uint32_t)input[19] << 10) |
			((uint32_t)(input[20] & 0x80) << 2);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 161 to 183
	value = ((uint32_t)(input[20] & 0x7f) << 25) |
			((uint32_t)input[21] << 17) |
			((uint32_t)input[22] << 9);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 184 to 206
	value = ((uint32_t)input[23] << 24) |
			((uint32_t)input[24] << 16) |
			((uint32_t)(input[25] & 0xfe) << 8);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 207 to 229
	value = ((uint32_t)(input[25] & 0x01) << 31) |
			((uint32_t)input[26] << 23) |
			((uint32_t)input[27] << 15) |
			((uint32_t)(input[28] & 0xfc) << 7);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 230 to 252
	value = ((uint32_t)(input[28] & 0x03) << 30) |
			((uint32_t)input[29] << 22) |
			((uint32_t)input[30] << 14) |
			((uint32_t)(input[31] & 0xf8) << 6);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 253 to 275
	value = ((uint32_t)(input[31] & 0x07) << 29) |
			((uint32_t)input[32] << 21) |
			((uint32_t)input[33] << 13) |
			((uint32_t)(input[34] & 0xf0) << 5);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 276 to 298
	value = ((uint32_t)(input[34] & 0x0f) << 28) |
			((uint32_t)input[35] << 20) |
			((uint32_t)input[36] << 12) |
			((uint32_t)(input[37] & 0xe0) << 4);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 299 to 321
	value = ((uint32_t)(input[37] & 0x1f) << 27) |
			((uint32_t)input[38] << 19) |
			((uint32_t)input[39] << 11) |
			((uint32_t)(input[40] & 0xc0) << 3);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 322 to 344
	value = ((uint32_t)(input[40] & 0x3f) << 26) |
			((uint32_t)input[41] << 18) |
			((uint32_t)input[42] << 10) |
			((uint32_t)(input[43] & 0x80) << 2);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 345 to 367
	value = ((uint32_t)(input[43] & 0x7f) << 25) |
			((uint32_t)input[44] << 17) |
			((uint32_t)input[45] << 9);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 368 to 390
	value = ((uint32_t)input[46] << 24) |
			((uint32_t)input[47] << 16) |
			((uint32_t)(input[48] & 0xfe) << 8);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 391 to 413
	value = ((uint32_t)(input[48] & 0x01) << 31) |
			((uint32_t)input[49] << 23) |
			((uint32_t)input[50] << 15) |
			((uint32_t)(input[51] & 0xfc) << 7);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 414 to 436
	value = ((uint32_t)(input[51] & 0x03) << 30) |
			((uint32_t)input[52] << 22) |
			((uint32_t)input[53] << 14) |
			((uint32_t)(input[54] & 0xf8) << 6);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 437 to 459
	value = ((uint32_t)(input[54] & 0x07) << 29) |
			((uint32_t)input[55] << 21) |
			((uint32_t)input[56] << 13) |
			((uint32_t)(input[57] & 0xf0) << 5);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 460 to 482
	value = ((uint32_t)(input[57] & 0x0f) << 28) |
			((uint32_t)input[58] << 20) |
			((uint32_t)input[59] << 12) |
			((uint32_t)(input[60] & 0xe0) << 4);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 483 to 505
	value = ((uint32_t)(input[60] & 0x1f) << 27) |
			((uint32_t)input[61] << 19) |
			((uint32_t)input[62] << 11) |
			((uint32_t)(input[63] & 0xc0) << 3);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_1off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 1 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 461 to 483
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)input[58] << 21) |
			((uint32_t)input[59] << 13) |
			((uint32_t)(input[60] & 0xf0) << 5);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 484 to 506
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)input[61] << 20) |
			((uint32_t)input[62] << 12) |
			((uint32_t)(input[63] & 0xe0) << 4);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_1off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 1 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

	// read output[1]: from bit 24 to 46
	value = ((uint32_t)input[3] << 24) |
			((uint32_t)input[4] << 16) |
			((uint32_t)(input[5] & 0xfe) << 8);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 47 to 69
	value = ((uint32_t)(input[5] & 0x01) << 31) |
			((uint32_t)input[6] << 23) |
			((uint32_t)input[7] << 15) |
			((uint32_t)(input[8] & 0xfc) << 7);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 70 to 92
	value = ((uint32_t)(input[8] & 0x03) << 30) |
			((uint32_t)input[9] << 22) |
			((uint32_t)input[10] << 14) |
			((uint32_t)(input[11] & 0xf8) << 6);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 93 to 115
	value = ((uint32_t)(input[11] & 0x07) << 29) |
			((uint32_t)input[12] << 21) |
			((uint32_t)input[13] << 13) |
			((uint32_t)(input[14] & 0xf0) << 5);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 116 to 138
	value = ((uint32_t)(input[14] & 0x0f) << 28) |
			((uint32_t)input[15] << 20) |
			((uint32_t)input[16] << 12) |
			((uint32_t)(input[17] & 0xe0) << 4);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 139 to 161
	value = ((uint32_t)(input[17] & 0x1f) << 27) |
			((uint32_t)input[18] << 19) |
			((uint32_t)input[19] << 11) |
			((uint32_t)(input[20] & 0xc0) << 3);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 162 to 184
	value = ((uint32_t)(input[20] & 0x3f) << 26) |
			((uint32_t)input[21] << 18) |
			((uint32_t)input[22] << 10) |
			((uint32_t)(input[23] & 0x80) << 2);
	output[7] = (double)(value >> 9);

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

	// read output[9]: from bit 208 to 230
	value = ((uint32_t)input[26] << 24) |
			((uint32_t)input[27] << 16) |
			((uint32_t)(input[28] & 0xfe) << 8);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 231 to 253
	value = ((uint32_t)(input[28] & 0x01) << 31) |
			((uint32_t)input[29] << 23) |
			((uint32_t)input[30] << 15) |
			((uint32_t)(input[31] & 0xfc) << 7);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 254 to 276
	value = ((uint32_t)(input[31] & 0x03) << 30) |
			((uint32_t)input[32] << 22) |
			((uint32_t)input[33] << 14) |
			((uint32_t)(input[34] & 0xf8) << 6);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 277 to 299
	value = ((uint32_t)(input[34] & 0x07) << 29) |
			((uint32_t)input[35] << 21) |
			((uint32_t)input[36] << 13) |
			((uint32_t)(input[37] & 0xf0) << 5);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 300 to 322
	value = ((uint32_t)(input[37] & 0x0f) << 28) |
			((uint32_t)input[38] << 20) |
			((uint32_t)input[39] << 12) |
			((uint32_t)(input[40] & 0xe0) << 4);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 323 to 345
	value = ((uint32_t)(input[40] & 0x1f) << 27) |
			((uint32_t)input[41] << 19) |
			((uint32_t)input[42] << 11) |
			((uint32_t)(input[43] & 0xc0) << 3);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 346 to 368
	value = ((uint32_t)(input[43] & 0x3f) << 26) |
			((uint32_t)input[44] << 18) |
			((uint32_t)input[45] << 10) |
			((uint32_t)(input[46] & 0x80) << 2);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 369 to 391
	value = ((uint32_t)(input[46] & 0x7f) << 25) |
			((uint32_t)input[47] << 17) |
			((uint32_t)input[48] << 9);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 392 to 414
	value = ((uint32_t)input[49] << 24) |
			((uint32_t)input[50] << 16) |
			((uint32_t)(input[51] & 0xfe) << 8);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 415 to 437
	value = ((uint32_t)(input[51] & 0x01) << 31) |
			((uint32_t)input[52] << 23) |
			((uint32_t)input[53] << 15) |
			((uint32_t)(input[54] & 0xfc) << 7);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 438 to 460
	value = ((uint32_t)(input[54] & 0x03) << 30) |
			((uint32_t)input[55] << 22) |
			((uint32_t)input[56] << 14) |
			((uint32_t)(input[57] & 0xf8) << 6);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 461 to 483
	value = ((uint32_t)(input[57] & 0x07) << 29) |
			((uint32_t)input[58] << 21) |
			((uint32_t)input[59] << 13) |
			((uint32_t)(input[60] & 0xf0) << 5);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 484 to 506
	value = ((uint32_t)(input[60] & 0x0f) << 28) |
			((uint32_t)input[61] << 20) |
			((uint32_t)input[62] << 12) |
			((uint32_t)(input[63] & 0xe0) << 4);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_2off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 2 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 462 to 484
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)input[58] << 22) |
			((uint32_t)input[59] << 14) |
			((uint32_t)(input[60] & 0xf8) << 6);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 485 to 507
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)input[61] << 21) |
			((uint32_t)input[62] << 13) |
			((uint32_t)(input[63] & 0xf0) << 5);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_2off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 2 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

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

	// read output[2]: from bit 48 to 70
	value = ((uint32_t)input[6] << 24) |
			((uint32_t)input[7] << 16) |
			((uint32_t)(input[8] & 0xfe) << 8);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 71 to 93
	value = ((uint32_t)(input[8] & 0x01) << 31) |
			((uint32_t)input[9] << 23) |
			((uint32_t)input[10] << 15) |
			((uint32_t)(input[11] & 0xfc) << 7);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 94 to 116
	value = ((uint32_t)(input[11] & 0x03) << 30) |
			((uint32_t)input[12] << 22) |
			((uint32_t)input[13] << 14) |
			((uint32_t)(input[14] & 0xf8) << 6);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 117 to 139
	value = ((uint32_t)(input[14] & 0x07) << 29) |
			((uint32_t)input[15] << 21) |
			((uint32_t)input[16] << 13) |
			((uint32_t)(input[17] & 0xf0) << 5);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 140 to 162
	value = ((uint32_t)(input[17] & 0x0f) << 28) |
			((uint32_t)input[18] << 20) |
			((uint32_t)input[19] << 12) |
			((uint32_t)(input[20] & 0xe0) << 4);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 163 to 185
	value = ((uint32_t)(input[20] & 0x1f) << 27) |
			((uint32_t)input[21] << 19) |
			((uint32_t)input[22] << 11) |
			((uint32_t)(input[23] & 0xc0) << 3);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 186 to 208
	value = ((uint32_t)(input[23] & 0x3f) << 26) |
			((uint32_t)input[24] << 18) |
			((uint32_t)input[25] << 10) |
			((uint32_t)(input[26] & 0x80) << 2);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 209 to 231
	value = ((uint32_t)(input[26] & 0x7f) << 25) |
			((uint32_t)input[27] << 17) |
			((uint32_t)input[28] << 9);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 232 to 254
	value = ((uint32_t)input[29] << 24) |
			((uint32_t)input[30] << 16) |
			((uint32_t)(input[31] & 0xfe) << 8);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 255 to 277
	value = ((uint32_t)(input[31] & 0x01) << 31) |
			((uint32_t)input[32] << 23) |
			((uint32_t)input[33] << 15) |
			((uint32_t)(input[34] & 0xfc) << 7);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 278 to 300
	value = ((uint32_t)(input[34] & 0x03) << 30) |
			((uint32_t)input[35] << 22) |
			((uint32_t)input[36] << 14) |
			((uint32_t)(input[37] & 0xf8) << 6);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 301 to 323
	value = ((uint32_t)(input[37] & 0x07) << 29) |
			((uint32_t)input[38] << 21) |
			((uint32_t)input[39] << 13) |
			((uint32_t)(input[40] & 0xf0) << 5);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 324 to 346
	value = ((uint32_t)(input[40] & 0x0f) << 28) |
			((uint32_t)input[41] << 20) |
			((uint32_t)input[42] << 12) |
			((uint32_t)(input[43] & 0xe0) << 4);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 347 to 369
	value = ((uint32_t)(input[43] & 0x1f) << 27) |
			((uint32_t)input[44] << 19) |
			((uint32_t)input[45] << 11) |
			((uint32_t)(input[46] & 0xc0) << 3);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 370 to 392
	value = ((uint32_t)(input[46] & 0x3f) << 26) |
			((uint32_t)input[47] << 18) |
			((uint32_t)input[48] << 10) |
			((uint32_t)(input[49] & 0x80) << 2);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 393 to 415
	value = ((uint32_t)(input[49] & 0x7f) << 25) |
			((uint32_t)input[50] << 17) |
			((uint32_t)input[51] << 9);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 416 to 438
	value = ((uint32_t)input[52] << 24) |
			((uint32_t)input[53] << 16) |
			((uint32_t)(input[54] & 0xfe) << 8);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 439 to 461
	value = ((uint32_t)(input[54] & 0x01) << 31) |
			((uint32_t)input[55] << 23) |
			((uint32_t)input[56] << 15) |
			((uint32_t)(input[57] & 0xfc) << 7);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 462 to 484
	value = ((uint32_t)(input[57] & 0x03) << 30) |
			((uint32_t)input[58] << 22) |
			((uint32_t)input[59] << 14) |
			((uint32_t)(input[60] & 0xf8) << 6);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 485 to 507
	value = ((uint32_t)(input[60] & 0x07) << 29) |
			((uint32_t)input[61] << 21) |
			((uint32_t)input[62] << 13) |
			((uint32_t)(input[63] & 0xf0) << 5);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_3off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 3 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 463 to 485
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)input[58] << 23) |
			((uint32_t)input[59] << 15) |
			((uint32_t)(input[60] & 0xfc) << 7);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 486 to 508
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)input[61] << 22) |
			((uint32_t)input[62] << 14) |
			((uint32_t)(input[63] & 0xf8) << 6);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_3off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 3 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

	// read output[1]: from bit 26 to 48
	value = ((uint32_t)(input[3] & 0x3f) << 26) |
			((uint32_t)input[4] << 18) |
			((uint32_t)input[5] << 10) |
			((uint32_t)(input[6] & 0x80) << 2);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 49 to 71
	value = ((uint32_t)(input[6] & 0x7f) << 25) |
			((uint32_t)input[7] << 17) |
			((uint32_t)input[8] << 9);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 72 to 94
	value = ((uint32_t)input[9] << 24) |
			((uint32_t)input[10] << 16) |
			((uint32_t)(input[11] & 0xfe) << 8);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 95 to 117
	value = ((uint32_t)(input[11] & 0x01) << 31) |
			((uint32_t)input[12] << 23) |
			((uint32_t)input[13] << 15) |
			((uint32_t)(input[14] & 0xfc) << 7);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 118 to 140
	value = ((uint32_t)(input[14] & 0x03) << 30) |
			((uint32_t)input[15] << 22) |
			((uint32_t)input[16] << 14) |
			((uint32_t)(input[17] & 0xf8) << 6);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 141 to 163
	value = ((uint32_t)(input[17] & 0x07) << 29) |
			((uint32_t)input[18] << 21) |
			((uint32_t)input[19] << 13) |
			((uint32_t)(input[20] & 0xf0) << 5);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 164 to 186
	value = ((uint32_t)(input[20] & 0x0f) << 28) |
			((uint32_t)input[21] << 20) |
			((uint32_t)input[22] << 12) |
			((uint32_t)(input[23] & 0xe0) << 4);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 187 to 209
	value = ((uint32_t)(input[23] & 0x1f) << 27) |
			((uint32_t)input[24] << 19) |
			((uint32_t)input[25] << 11) |
			((uint32_t)(input[26] & 0xc0) << 3);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 210 to 232
	value = ((uint32_t)(input[26] & 0x3f) << 26) |
			((uint32_t)input[27] << 18) |
			((uint32_t)input[28] << 10) |
			((uint32_t)(input[29] & 0x80) << 2);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 233 to 255
	value = ((uint32_t)(input[29] & 0x7f) << 25) |
			((uint32_t)input[30] << 17) |
			((uint32_t)input[31] << 9);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 256 to 278
	value = ((uint32_t)input[32] << 24) |
			((uint32_t)input[33] << 16) |
			((uint32_t)(input[34] & 0xfe) << 8);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 279 to 301
	value = ((uint32_t)(input[34] & 0x01) << 31) |
			((uint32_t)input[35] << 23) |
			((uint32_t)input[36] << 15) |
			((uint32_t)(input[37] & 0xfc) << 7);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 302 to 324
	value = ((uint32_t)(input[37] & 0x03) << 30) |
			((uint32_t)input[38] << 22) |
			((uint32_t)input[39] << 14) |
			((uint32_t)(input[40] & 0xf8) << 6);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 325 to 347
	value = ((uint32_t)(input[40] & 0x07) << 29) |
			((uint32_t)input[41] << 21) |
			((uint32_t)input[42] << 13) |
			((uint32_t)(input[43] & 0xf0) << 5);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 348 to 370
	value = ((uint32_t)(input[43] & 0x0f) << 28) |
			((uint32_t)input[44] << 20) |
			((uint32_t)input[45] << 12) |
			((uint32_t)(input[46] & 0xe0) << 4);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 371 to 393
	value = ((uint32_t)(input[46] & 0x1f) << 27) |
			((uint32_t)input[47] << 19) |
			((uint32_t)input[48] << 11) |
			((uint32_t)(input[49] & 0xc0) << 3);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 394 to 416
	value = ((uint32_t)(input[49] & 0x3f) << 26) |
			((uint32_t)input[50] << 18) |
			((uint32_t)input[51] << 10) |
			((uint32_t)(input[52] & 0x80) << 2);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 417 to 439
	value = ((uint32_t)(input[52] & 0x7f) << 25) |
			((uint32_t)input[53] << 17) |
			((uint32_t)input[54] << 9);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 440 to 462
	value = ((uint32_t)input[55] << 24) |
			((uint32_t)input[56] << 16) |
			((uint32_t)(input[57] & 0xfe) << 8);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 463 to 485
	value = ((uint32_t)(input[57] & 0x01) << 31) |
			((uint32_t)input[58] << 23) |
			((uint32_t)input[59] << 15) |
			((uint32_t)(input[60] & 0xfc) << 7);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 486 to 508
	value = ((uint32_t)(input[60] & 0x03) << 30) |
			((uint32_t)input[61] << 22) |
			((uint32_t)input[62] << 14) |
			((uint32_t)(input[63] & 0xf8) << 6);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_4off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 4 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 464 to 486
	value = ((uint32_t)input[58] << 24) |
			((uint32_t)input[59] << 16) |
			((uint32_t)(input[60] & 0xfe) << 8);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 487 to 509
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)input[61] << 23) |
			((uint32_t)input[62] << 15) |
			((uint32_t)(input[63] & 0xfc) << 7);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_4off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 4 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

	// read output[1]: from bit 27 to 49
	value = ((uint32_t)(input[3] & 0x1f) << 27) |
			((uint32_t)input[4] << 19) |
			((uint32_t)input[5] << 11) |
			((uint32_t)(input[6] & 0xc0) << 3);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 50 to 72
	value = ((uint32_t)(input[6] & 0x3f) << 26) |
			((uint32_t)input[7] << 18) |
			((uint32_t)input[8] << 10) |
			((uint32_t)(input[9] & 0x80) << 2);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 73 to 95
	value = ((uint32_t)(input[9] & 0x7f) << 25) |
			((uint32_t)input[10] << 17) |
			((uint32_t)input[11] << 9);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 96 to 118
	value = ((uint32_t)input[12] << 24) |
			((uint32_t)input[13] << 16) |
			((uint32_t)(input[14] & 0xfe) << 8);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 119 to 141
	value = ((uint32_t)(input[14] & 0x01) << 31) |
			((uint32_t)input[15] << 23) |
			((uint32_t)input[16] << 15) |
			((uint32_t)(input[17] & 0xfc) << 7);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 142 to 164
	value = ((uint32_t)(input[17] & 0x03) << 30) |
			((uint32_t)input[18] << 22) |
			((uint32_t)input[19] << 14) |
			((uint32_t)(input[20] & 0xf8) << 6);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 165 to 187
	value = ((uint32_t)(input[20] & 0x07) << 29) |
			((uint32_t)input[21] << 21) |
			((uint32_t)input[22] << 13) |
			((uint32_t)(input[23] & 0xf0) << 5);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 188 to 210
	value = ((uint32_t)(input[23] & 0x0f) << 28) |
			((uint32_t)input[24] << 20) |
			((uint32_t)input[25] << 12) |
			((uint32_t)(input[26] & 0xe0) << 4);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 211 to 233
	value = ((uint32_t)(input[26] & 0x1f) << 27) |
			((uint32_t)input[27] << 19) |
			((uint32_t)input[28] << 11) |
			((uint32_t)(input[29] & 0xc0) << 3);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 234 to 256
	value = ((uint32_t)(input[29] & 0x3f) << 26) |
			((uint32_t)input[30] << 18) |
			((uint32_t)input[31] << 10) |
			((uint32_t)(input[32] & 0x80) << 2);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 257 to 279
	value = ((uint32_t)(input[32] & 0x7f) << 25) |
			((uint32_t)input[33] << 17) |
			((uint32_t)input[34] << 9);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 280 to 302
	value = ((uint32_t)input[35] << 24) |
			((uint32_t)input[36] << 16) |
			((uint32_t)(input[37] & 0xfe) << 8);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 303 to 325
	value = ((uint32_t)(input[37] & 0x01) << 31) |
			((uint32_t)input[38] << 23) |
			((uint32_t)input[39] << 15) |
			((uint32_t)(input[40] & 0xfc) << 7);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 326 to 348
	value = ((uint32_t)(input[40] & 0x03) << 30) |
			((uint32_t)input[41] << 22) |
			((uint32_t)input[42] << 14) |
			((uint32_t)(input[43] & 0xf8) << 6);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 349 to 371
	value = ((uint32_t)(input[43] & 0x07) << 29) |
			((uint32_t)input[44] << 21) |
			((uint32_t)input[45] << 13) |
			((uint32_t)(input[46] & 0xf0) << 5);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 372 to 394
	value = ((uint32_t)(input[46] & 0x0f) << 28) |
			((uint32_t)input[47] << 20) |
			((uint32_t)input[48] << 12) |
			((uint32_t)(input[49] & 0xe0) << 4);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 395 to 417
	value = ((uint32_t)(input[49] & 0x1f) << 27) |
			((uint32_t)input[50] << 19) |
			((uint32_t)input[51] << 11) |
			((uint32_t)(input[52] & 0xc0) << 3);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 418 to 440
	value = ((uint32_t)(input[52] & 0x3f) << 26) |
			((uint32_t)input[53] << 18) |
			((uint32_t)input[54] << 10) |
			((uint32_t)(input[55] & 0x80) << 2);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 441 to 463
	value = ((uint32_t)(input[55] & 0x7f) << 25) |
			((uint32_t)input[56] << 17) |
			((uint32_t)input[57] << 9);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 464 to 486
	value = ((uint32_t)input[58] << 24) |
			((uint32_t)input[59] << 16) |
			((uint32_t)(input[60] & 0xfe) << 8);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 487 to 509
	value = ((uint32_t)(input[60] & 0x01) << 31) |
			((uint32_t)input[61] << 23) |
			((uint32_t)input[62] << 15) |
			((uint32_t)(input[63] & 0xfc) << 7);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_5off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 5 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 465 to 487
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)input[59] << 17) |
			((uint32_t)input[60] << 9);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 488 to 510
	value = ((uint32_t)input[61] << 24) |
			((uint32_t)input[62] << 16) |
			((uint32_t)(input[63] & 0xfe) << 8);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_5off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 5 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

	// read output[1]: from bit 28 to 50
	value = ((uint32_t)(input[3] & 0x0f) << 28) |
			((uint32_t)input[4] << 20) |
			((uint32_t)input[5] << 12) |
			((uint32_t)(input[6] & 0xe0) << 4);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 51 to 73
	value = ((uint32_t)(input[6] & 0x1f) << 27) |
			((uint32_t)input[7] << 19) |
			((uint32_t)input[8] << 11) |
			((uint32_t)(input[9] & 0xc0) << 3);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 74 to 96
	value = ((uint32_t)(input[9] & 0x3f) << 26) |
			((uint32_t)input[10] << 18) |
			((uint32_t)input[11] << 10) |
			((uint32_t)(input[12] & 0x80) << 2);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 97 to 119
	value = ((uint32_t)(input[12] & 0x7f) << 25) |
			((uint32_t)input[13] << 17) |
			((uint32_t)input[14] << 9);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 120 to 142
	value = ((uint32_t)input[15] << 24) |
			((uint32_t)input[16] << 16) |
			((uint32_t)(input[17] & 0xfe) << 8);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 143 to 165
	value = ((uint32_t)(input[17] & 0x01) << 31) |
			((uint32_t)input[18] << 23) |
			((uint32_t)input[19] << 15) |
			((uint32_t)(input[20] & 0xfc) << 7);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 166 to 188
	value = ((uint32_t)(input[20] & 0x03) << 30) |
			((uint32_t)input[21] << 22) |
			((uint32_t)input[22] << 14) |
			((uint32_t)(input[23] & 0xf8) << 6);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 189 to 211
	value = ((uint32_t)(input[23] & 0x07) << 29) |
			((uint32_t)input[24] << 21) |
			((uint32_t)input[25] << 13) |
			((uint32_t)(input[26] & 0xf0) << 5);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 212 to 234
	value = ((uint32_t)(input[26] & 0x0f) << 28) |
			((uint32_t)input[27] << 20) |
			((uint32_t)input[28] << 12) |
			((uint32_t)(input[29] & 0xe0) << 4);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 235 to 257
	value = ((uint32_t)(input[29] & 0x1f) << 27) |
			((uint32_t)input[30] << 19) |
			((uint32_t)input[31] << 11) |
			((uint32_t)(input[32] & 0xc0) << 3);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 258 to 280
	value = ((uint32_t)(input[32] & 0x3f) << 26) |
			((uint32_t)input[33] << 18) |
			((uint32_t)input[34] << 10) |
			((uint32_t)(input[35] & 0x80) << 2);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 281 to 303
	value = ((uint32_t)(input[35] & 0x7f) << 25) |
			((uint32_t)input[36] << 17) |
			((uint32_t)input[37] << 9);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 304 to 326
	value = ((uint32_t)input[38] << 24) |
			((uint32_t)input[39] << 16) |
			((uint32_t)(input[40] & 0xfe) << 8);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 327 to 349
	value = ((uint32_t)(input[40] & 0x01) << 31) |
			((uint32_t)input[41] << 23) |
			((uint32_t)input[42] << 15) |
			((uint32_t)(input[43] & 0xfc) << 7);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 350 to 372
	value = ((uint32_t)(input[43] & 0x03) << 30) |
			((uint32_t)input[44] << 22) |
			((uint32_t)input[45] << 14) |
			((uint32_t)(input[46] & 0xf8) << 6);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 373 to 395
	value = ((uint32_t)(input[46] & 0x07) << 29) |
			((uint32_t)input[47] << 21) |
			((uint32_t)input[48] << 13) |
			((uint32_t)(input[49] & 0xf0) << 5);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 396 to 418
	value = ((uint32_t)(input[49] & 0x0f) << 28) |
			((uint32_t)input[50] << 20) |
			((uint32_t)input[51] << 12) |
			((uint32_t)(input[52] & 0xe0) << 4);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 419 to 441
	value = ((uint32_t)(input[52] & 0x1f) << 27) |
			((uint32_t)input[53] << 19) |
			((uint32_t)input[54] << 11) |
			((uint32_t)(input[55] & 0xc0) << 3);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 442 to 464
	value = ((uint32_t)(input[55] & 0x3f) << 26) |
			((uint32_t)input[56] << 18) |
			((uint32_t)input[57] << 10) |
			((uint32_t)(input[58] & 0x80) << 2);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 465 to 487
	value = ((uint32_t)(input[58] & 0x7f) << 25) |
			((uint32_t)input[59] << 17) |
			((uint32_t)input[60] << 9);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 488 to 510
	value = ((uint32_t)input[61] << 24) |
			((uint32_t)input[62] << 16) |
			((uint32_t)(input[63] & 0xfe) << 8);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_6off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 6 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	int32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 466 to 488
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)input[59] << 18) |
			((uint32_t)input[60] << 10) |
			((uint32_t)(input[61] & 0x80) << 2);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 489 to 511
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)input[62] << 17) |
			((uint32_t)input[63] << 9);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_6off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 6 bits, read 506 bits of data.
	// Input must be at least 64 bytes long

	uint32_t value;

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

	// read output[1]: from bit 29 to 51
	value = ((uint32_t)(input[3] & 0x07) << 29) |
			((uint32_t)input[4] << 21) |
			((uint32_t)input[5] << 13) |
			((uint32_t)(input[6] & 0xf0) << 5);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 52 to 74
	value = ((uint32_t)(input[6] & 0x0f) << 28) |
			((uint32_t)input[7] << 20) |
			((uint32_t)input[8] << 12) |
			((uint32_t)(input[9] & 0xe0) << 4);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 75 to 97
	value = ((uint32_t)(input[9] & 0x1f) << 27) |
			((uint32_t)input[10] << 19) |
			((uint32_t)input[11] << 11) |
			((uint32_t)(input[12] & 0xc0) << 3);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 98 to 120
	value = ((uint32_t)(input[12] & 0x3f) << 26) |
			((uint32_t)input[13] << 18) |
			((uint32_t)input[14] << 10) |
			((uint32_t)(input[15] & 0x80) << 2);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 121 to 143
	value = ((uint32_t)(input[15] & 0x7f) << 25) |
			((uint32_t)input[16] << 17) |
			((uint32_t)input[17] << 9);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 144 to 166
	value = ((uint32_t)input[18] << 24) |
			((uint32_t)input[19] << 16) |
			((uint32_t)(input[20] & 0xfe) << 8);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 167 to 189
	value = ((uint32_t)(input[20] & 0x01) << 31) |
			((uint32_t)input[21] << 23) |
			((uint32_t)input[22] << 15) |
			((uint32_t)(input[23] & 0xfc) << 7);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 190 to 212
	value = ((uint32_t)(input[23] & 0x03) << 30) |
			((uint32_t)input[24] << 22) |
			((uint32_t)input[25] << 14) |
			((uint32_t)(input[26] & 0xf8) << 6);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 213 to 235
	value = ((uint32_t)(input[26] & 0x07) << 29) |
			((uint32_t)input[27] << 21) |
			((uint32_t)input[28] << 13) |
			((uint32_t)(input[29] & 0xf0) << 5);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 236 to 258
	value = ((uint32_t)(input[29] & 0x0f) << 28) |
			((uint32_t)input[30] << 20) |
			((uint32_t)input[31] << 12) |
			((uint32_t)(input[32] & 0xe0) << 4);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 259 to 281
	value = ((uint32_t)(input[32] & 0x1f) << 27) |
			((uint32_t)input[33] << 19) |
			((uint32_t)input[34] << 11) |
			((uint32_t)(input[35] & 0xc0) << 3);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 282 to 304
	value = ((uint32_t)(input[35] & 0x3f) << 26) |
			((uint32_t)input[36] << 18) |
			((uint32_t)input[37] << 10) |
			((uint32_t)(input[38] & 0x80) << 2);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 305 to 327
	value = ((uint32_t)(input[38] & 0x7f) << 25) |
			((uint32_t)input[39] << 17) |
			((uint32_t)input[40] << 9);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 328 to 350
	value = ((uint32_t)input[41] << 24) |
			((uint32_t)input[42] << 16) |
			((uint32_t)(input[43] & 0xfe) << 8);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 351 to 373
	value = ((uint32_t)(input[43] & 0x01) << 31) |
			((uint32_t)input[44] << 23) |
			((uint32_t)input[45] << 15) |
			((uint32_t)(input[46] & 0xfc) << 7);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 374 to 396
	value = ((uint32_t)(input[46] & 0x03) << 30) |
			((uint32_t)input[47] << 22) |
			((uint32_t)input[48] << 14) |
			((uint32_t)(input[49] & 0xf8) << 6);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 397 to 419
	value = ((uint32_t)(input[49] & 0x07) << 29) |
			((uint32_t)input[50] << 21) |
			((uint32_t)input[51] << 13) |
			((uint32_t)(input[52] & 0xf0) << 5);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 420 to 442
	value = ((uint32_t)(input[52] & 0x0f) << 28) |
			((uint32_t)input[53] << 20) |
			((uint32_t)input[54] << 12) |
			((uint32_t)(input[55] & 0xe0) << 4);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 443 to 465
	value = ((uint32_t)(input[55] & 0x1f) << 27) |
			((uint32_t)input[56] << 19) |
			((uint32_t)input[57] << 11) |
			((uint32_t)(input[58] & 0xc0) << 3);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 466 to 488
	value = ((uint32_t)(input[58] & 0x3f) << 26) |
			((uint32_t)input[59] << 18) |
			((uint32_t)input[60] << 10) |
			((uint32_t)(input[61] & 0x80) << 2);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 489 to 511
	value = ((uint32_t)(input[61] & 0x7f) << 25) |
			((uint32_t)input[62] << 17) |
			((uint32_t)input[63] << 9);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_signed_7off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit signed
	// Skip 7 bits, read 506 bits of data.
	// Input must be at least 65 bytes long

	int32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 467 to 489
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)input[59] << 19) |
			((uint32_t)input[60] << 11) |
			((uint32_t)(input[61] & 0xc0) << 3);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 490 to 512
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)input[62] << 18) |
			((uint32_t)input[63] << 10) |
			((uint32_t)(input[64] & 0x80) << 2);
	output[21] = (double)(value >> 9);
}

static void unpack_22_23bit_unsigned_7off(const uint8_t * input, double * output) {
	// Unpack 22 values into output
	// Values are 23-bit unsigned
	// Skip 7 bits, read 506 bits of data.
	// Input must be at least 65 bytes long

	uint32_t value;

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

	// read output[1]: from bit 30 to 52
	value = ((uint32_t)(input[3] & 0x03) << 30) |
			((uint32_t)input[4] << 22) |
			((uint32_t)input[5] << 14) |
			((uint32_t)(input[6] & 0xf8) << 6);
	output[1] = (double)(value >> 9);

	// read output[2]: from bit 53 to 75
	value = ((uint32_t)(input[6] & 0x07) << 29) |
			((uint32_t)input[7] << 21) |
			((uint32_t)input[8] << 13) |
			((uint32_t)(input[9] & 0xf0) << 5);
	output[2] = (double)(value >> 9);

	// read output[3]: from bit 76 to 98
	value = ((uint32_t)(input[9] & 0x0f) << 28) |
			((uint32_t)input[10] << 20) |
			((uint32_t)input[11] << 12) |
			((uint32_t)(input[12] & 0xe0) << 4);
	output[3] = (double)(value >> 9);

	// read output[4]: from bit 99 to 121
	value = ((uint32_t)(input[12] & 0x1f) << 27) |
			((uint32_t)input[13] << 19) |
			((uint32_t)input[14] << 11) |
			((uint32_t)(input[15] & 0xc0) << 3);
	output[4] = (double)(value >> 9);

	// read output[5]: from bit 122 to 144
	value = ((uint32_t)(input[15] & 0x3f) << 26) |
			((uint32_t)input[16] << 18) |
			((uint32_t)input[17] << 10) |
			((uint32_t)(input[18] & 0x80) << 2);
	output[5] = (double)(value >> 9);

	// read output[6]: from bit 145 to 167
	value = ((uint32_t)(input[18] & 0x7f) << 25) |
			((uint32_t)input[19] << 17) |
			((uint32_t)input[20] << 9);
	output[6] = (double)(value >> 9);

	// read output[7]: from bit 168 to 190
	value = ((uint32_t)input[21] << 24) |
			((uint32_t)input[22] << 16) |
			((uint32_t)(input[23] & 0xfe) << 8);
	output[7] = (double)(value >> 9);

	// read output[8]: from bit 191 to 213
	value = ((uint32_t)(input[23] & 0x01) << 31) |
			((uint32_t)input[24] << 23) |
			((uint32_t)input[25] << 15) |
			((uint32_t)(input[26] & 0xfc) << 7);
	output[8] = (double)(value >> 9);

	// read output[9]: from bit 214 to 236
	value = ((uint32_t)(input[26] & 0x03) << 30) |
			((uint32_t)input[27] << 22) |
			((uint32_t)input[28] << 14) |
			((uint32_t)(input[29] & 0xf8) << 6);
	output[9] = (double)(value >> 9);

	// read output[10]: from bit 237 to 259
	value = ((uint32_t)(input[29] & 0x07) << 29) |
			((uint32_t)input[30] << 21) |
			((uint32_t)input[31] << 13) |
			((uint32_t)(input[32] & 0xf0) << 5);
	output[10] = (double)(value >> 9);

	// read output[11]: from bit 260 to 282
	value = ((uint32_t)(input[32] & 0x0f) << 28) |
			((uint32_t)input[33] << 20) |
			((uint32_t)input[34] << 12) |
			((uint32_t)(input[35] & 0xe0) << 4);
	output[11] = (double)(value >> 9);

	// read output[12]: from bit 283 to 305
	value = ((uint32_t)(input[35] & 0x1f) << 27) |
			((uint32_t)input[36] << 19) |
			((uint32_t)input[37] << 11) |
			((uint32_t)(input[38] & 0xc0) << 3);
	output[12] = (double)(value >> 9);

	// read output[13]: from bit 306 to 328
	value = ((uint32_t)(input[38] & 0x3f) << 26) |
			((uint32_t)input[39] << 18) |
			((uint32_t)input[40] << 10) |
			((uint32_t)(input[41] & 0x80) << 2);
	output[13] = (double)(value >> 9);

	// read output[14]: from bit 329 to 351
	value = ((uint32_t)(input[41] & 0x7f) << 25) |
			((uint32_t)input[42] << 17) |
			((uint32_t)input[43] << 9);
	output[14] = (double)(value >> 9);

	// read output[15]: from bit 352 to 374
	value = ((uint32_t)input[44] << 24) |
			((uint32_t)input[45] << 16) |
			((uint32_t)(input[46] & 0xfe) << 8);
	output[15] = (double)(value >> 9);

	// read output[16]: from bit 375 to 397
	value = ((uint32_t)(input[46] & 0x01) << 31) |
			((uint32_t)input[47] << 23) |
			((uint32_t)input[48] << 15) |
			((uint32_t)(input[49] & 0xfc) << 7);
	output[16] = (double)(value >> 9);

	// read output[17]: from bit 398 to 420
	value = ((uint32_t)(input[49] & 0x03) << 30) |
			((uint32_t)input[50] << 22) |
			((uint32_t)input[51] << 14) |
			((uint32_t)(input[52] & 0xf8) << 6);
	output[17] = (double)(value >> 9);

	// read output[18]: from bit 421 to 443
	value = ((uint32_t)(input[52] & 0x07) << 29) |
			((uint32_t)input[53] << 21) |
			((uint32_t)input[54] << 13) |
			((uint32_t)(input[55] & 0xf0) << 5);
	output[18] = (double)(value >> 9);

	// read output[19]: from bit 444 to 466
	value = ((uint32_t)(input[55] & 0x0f) << 28) |
			((uint32_t)input[56] << 20) |
			((uint32_t)input[57] << 12) |
			((uint32_t)(input[58] & 0xe0) << 4);
	output[19] = (double)(value >> 9);

	// read output[20]: from bit 467 to 489
	value = ((uint32_t)(input[58] & 0x1f) << 27) |
			((uint32_t)input[59] << 19) |
			((uint32_t)input[60] << 11) |
			((uint32_t)(input[61] & 0xc0) << 3);
	output[20] = (double)(value >> 9);

	// read output[21]: from bit 490 to 512
	value = ((uint32_t)(input[61] & 0x3f) << 26) |
			((uint32_t)input[62] << 18) |
			((uint32_t)input[63] << 10) |
			((uint32_t)(input[64] & 0x80) << 2);
	output[21] = (double)(value >> 9);
}


unpack_func_t unpack_23bit[UNPACK_23BIT_MAX_COUNT][8][2] = {
	{
		{
			unpack_1_23bit_unsigned_0off,
			unpack_1_23bit_signed_0off,
		},
		{
			unpack_1_23bit_unsigned_1off,
			unpack_1_23bit_signed_1off,
		},
		{
			unpack_1_23bit_unsigned_2off,
			unpack_1_23bit_signed_2off,
		},
		{
			unpack_1_23bit_unsigned_3off,
			unpack_1_23bit_signed_3off,
		},
		{
			unpack_1_23bit_unsigned_4off,
			unpack_1_23bit_signed_4off,
		},
		{
			unpack_1_23bit_unsigned_5off,
			unpack_1_23bit_signed_5off,
		},
		{
			unpack_1_23bit_unsigned_6off,
			unpack_1_23bit_signed_6off,
		},
		{
			unpack_1_23bit_unsigned_7off,
			unpack_1_23bit_signed_7off,
		},
	},
	{
		{
			unpack_2_23bit_unsigned_0off,
			unpack_2_23bit_signed_0off,
		},
		{
			unpack_2_23bit_unsigned_1off,
			unpack_2_23bit_signed_1off,
		},
		{
			unpack_2_23bit_unsigned_2off,
			unpack_2_23bit_signed_2off,
		},
		{
			unpack_2_23bit_unsigned_3off,
			unpack_2_23bit_signed_3off,
		},
		{
			unpack_2_23bit_unsigned_4off,
			unpack_2_23bit_signed_4off,
		},
		{
			unpack_2_23bit_unsigned_5off,
			unpack_2_23bit_signed_5off,
		},
		{
			unpack_2_23bit_unsigned_6off,
			unpack_2_23bit_signed_6off,
		},
		{
			unpack_2_23bit_unsigned_7off,
			unpack_2_23bit_signed_7off,
		},
	},
	{
		{
			unpack_3_23bit_unsigned_0off,
			unpack_3_23bit_signed_0off,
		},
		{
			unpack_3_23bit_unsigned_1off,
			unpack_3_23bit_signed_1off,
		},
		{
			unpack_3_23bit_unsigned_2off,
			unpack_3_23bit_signed_2off,
		},
		{
			unpack_3_23bit_unsigned_3off,
			unpack_3_23bit_signed_3off,
		},
		{
			unpack_3_23bit_unsigned_4off,
			unpack_3_23bit_signed_4off,
		},
		{
			unpack_3_23bit_unsigned_5off,
			unpack_3_23bit_signed_5off,
		},
		{
			unpack_3_23bit_unsigned_6off,
			unpack_3_23bit_signed_6off,
		},
		{
			unpack_3_23bit_unsigned_7off,
			unpack_3_23bit_signed_7off,
		},
	},
	{
		{
			unpack_4_23bit_unsigned_0off,
			unpack_4_23bit_signed_0off,
		},
		{
			unpack_4_23bit_unsigned_1off,
			unpack_4_23bit_signed_1off,
		},
		{
			unpack_4_23bit_unsigned_2off,
			unpack_4_23bit_signed_2off,
		},
		{
			unpack_4_23bit_unsigned_3off,
			unpack_4_23bit_signed_3off,
		},
		{
			unpack_4_23bit_unsigned_4off,
			unpack_4_23bit_signed_4off,
		},
		{
			unpack_4_23bit_unsigned_5off,
			unpack_4_23bit_signed_5off,
		},
		{
			unpack_4_23bit_unsigned_6off,
			unpack_4_23bit_signed_6off,
		},
		{
			unpack_4_23bit_unsigned_7off,
			unpack_4_23bit_signed_7off,
		},
	},
	{
		{
			unpack_5_23bit_unsigned_0off,
			unpack_5_23bit_signed_0off,
		},
		{
			unpack_5_23bit_unsigned_1off,
			unpack_5_23bit_signed_1off,
		},
		{
			unpack_5_23bit_unsigned_2off,
			unpack_5_23bit_signed_2off,
		},
		{
			unpack_5_23bit_unsigned_3off,
			unpack_5_23bit_signed_3off,
		},
		{
			unpack_5_23bit_unsigned_4off,
			unpack_5_23bit_signed_4off,
		},
		{
			unpack_5_23bit_unsigned_5off,
			unpack_5_23bit_signed_5off,
		},
		{
			unpack_5_23bit_unsigned_6off,
			unpack_5_23bit_signed_6off,
		},
		{
			unpack_5_23bit_unsigned_7off,
			unpack_5_23bit_signed_7off,
		},
	},
	{
		{
			unpack_6_23bit_unsigned_0off,
			unpack_6_23bit_signed_0off,
		},
		{
			unpack_6_23bit_unsigned_1off,
			unpack_6_23bit_signed_1off,
		},
		{
			unpack_6_23bit_unsigned_2off,
			unpack_6_23bit_signed_2off,
		},
		{
			unpack_6_23bit_unsigned_3off,
			unpack_6_23bit_signed_3off,
		},
		{
			unpack_6_23bit_unsigned_4off,
			unpack_6_23bit_signed_4off,
		},
		{
			unpack_6_23bit_unsigned_5off,
			unpack_6_23bit_signed_5off,
		},
		{
			unpack_6_23bit_unsigned_6off,
			unpack_6_23bit_signed_6off,
		},
		{
			unpack_6_23bit_unsigned_7off,
			unpack_6_23bit_signed_7off,
		},
	},
	{
		{
			unpack_7_23bit_unsigned_0off,
			unpack_7_23bit_signed_0off,
		},
		{
			unpack_7_23bit_unsigned_1off,
			unpack_7_23bit_signed_1off,
		},
		{
			unpack_7_23bit_unsigned_2off,
			unpack_7_23bit_signed_2off,
		},
		{
			unpack_7_23bit_unsigned_3off,
			unpack_7_23bit_signed_3off,
		},
		{
			unpack_7_23bit_unsigned_4off,
			unpack_7_23bit_signed_4off,
		},
		{
			unpack_7_23bit_unsigned_5off,
			unpack_7_23bit_signed_5off,
		},
		{
			unpack_7_23bit_unsigned_6off,
			unpack_7_23bit_signed_6off,
		},
		{
			unpack_7_23bit_unsigned_7off,
			unpack_7_23bit_signed_7off,
		},
	},
	{
		{
			unpack_8_23bit_unsigned_0off,
			unpack_8_23bit_signed_0off,
		},
		{
			unpack_8_23bit_unsigned_1off,
			unpack_8_23bit_signed_1off,
		},
		{
			unpack_8_23bit_unsigned_2off,
			unpack_8_23bit_signed_2off,
		},
		{
			unpack_8_23bit_unsigned_3off,
			unpack_8_23bit_signed_3off,
		},
		{
			unpack_8_23bit_unsigned_4off,
			unpack_8_23bit_signed_4off,
		},
		{
			unpack_8_23bit_unsigned_5off,
			unpack_8_23bit_signed_5off,
		},
		{
			unpack_8_23bit_unsigned_6off,
			unpack_8_23bit_signed_6off,
		},
		{
			unpack_8_23bit_unsigned_7off,
			unpack_8_23bit_signed_7off,
		},
	},
	{
		{
			unpack_9_23bit_unsigned_0off,
			unpack_9_23bit_signed_0off,
		},
		{
			unpack_9_23bit_unsigned_1off,
			unpack_9_23bit_signed_1off,
		},
		{
			unpack_9_23bit_unsigned_2off,
			unpack_9_23bit_signed_2off,
		},
		{
			unpack_9_23bit_unsigned_3off,
			unpack_9_23bit_signed_3off,
		},
		{
			unpack_9_23bit_unsigned_4off,
			unpack_9_23bit_signed_4off,
		},
		{
			unpack_9_23bit_unsigned_5off,
			unpack_9_23bit_signed_5off,
		},
		{
			unpack_9_23bit_unsigned_6off,
			unpack_9_23bit_signed_6off,
		},
		{
			unpack_9_23bit_unsigned_7off,
			unpack_9_23bit_signed_7off,
		},
	},
	{
		{
			unpack_10_23bit_unsigned_0off,
			unpack_10_23bit_signed_0off,
		},
		{
			unpack_10_23bit_unsigned_1off,
			unpack_10_23bit_signed_1off,
		},
		{
			unpack_10_23bit_unsigned_2off,
			unpack_10_23bit_signed_2off,
		},
		{
			unpack_10_23bit_unsigned_3off,
			unpack_10_23bit_signed_3off,
		},
		{
			unpack_10_23bit_unsigned_4off,
			unpack_10_23bit_signed_4off,
		},
		{
			unpack_10_23bit_unsigned_5off,
			unpack_10_23bit_signed_5off,
		},
		{
			unpack_10_23bit_unsigned_6off,
			unpack_10_23bit_signed_6off,
		},
		{
			unpack_10_23bit_unsigned_7off,
			unpack_10_23bit_signed_7off,
		},
	},
	{
		{
			unpack_11_23bit_unsigned_0off,
			unpack_11_23bit_signed_0off,
		},
		{
			unpack_11_23bit_unsigned_1off,
			unpack_11_23bit_signed_1off,
		},
		{
			unpack_11_23bit_unsigned_2off,
			unpack_11_23bit_signed_2off,
		},
		{
			unpack_11_23bit_unsigned_3off,
			unpack_11_23bit_signed_3off,
		},
		{
			unpack_11_23bit_unsigned_4off,
			unpack_11_23bit_signed_4off,
		},
		{
			unpack_11_23bit_unsigned_5off,
			unpack_11_23bit_signed_5off,
		},
		{
			unpack_11_23bit_unsigned_6off,
			unpack_11_23bit_signed_6off,
		},
		{
			unpack_11_23bit_unsigned_7off,
			unpack_11_23bit_signed_7off,
		},
	},
	{
		{
			unpack_12_23bit_unsigned_0off,
			unpack_12_23bit_signed_0off,
		},
		{
			unpack_12_23bit_unsigned_1off,
			unpack_12_23bit_signed_1off,
		},
		{
			unpack_12_23bit_unsigned_2off,
			unpack_12_23bit_signed_2off,
		},
		{
			unpack_12_23bit_unsigned_3off,
			unpack_12_23bit_signed_3off,
		},
		{
			unpack_12_23bit_unsigned_4off,
			unpack_12_23bit_signed_4off,
		},
		{
			unpack_12_23bit_unsigned_5off,
			unpack_12_23bit_signed_5off,
		},
		{
			unpack_12_23bit_unsigned_6off,
			unpack_12_23bit_signed_6off,
		},
		{
			unpack_12_23bit_unsigned_7off,
			unpack_12_23bit_signed_7off,
		},
	},
	{
		{
			unpack_13_23bit_unsigned_0off,
			unpack_13_23bit_signed_0off,
		},
		{
			unpack_13_23bit_unsigned_1off,
			unpack_13_23bit_signed_1off,
		},
		{
			unpack_13_23bit_unsigned_2off,
			unpack_13_23bit_signed_2off,
		},
		{
			unpack_13_23bit_unsigned_3off,
			unpack_13_23bit_signed_3off,
		},
		{
			unpack_13_23bit_unsigned_4off,
			unpack_13_23bit_signed_4off,
		},
		{
			unpack_13_23bit_unsigned_5off,
			unpack_13_23bit_signed_5off,
		},
		{
			unpack_13_23bit_unsigned_6off,
			unpack_13_23bit_signed_6off,
		},
		{
			unpack_13_23bit_unsigned_7off,
			unpack_13_23bit_signed_7off,
		},
	},
	{
		{
			unpack_14_23bit_unsigned_0off,
			unpack_14_23bit_signed_0off,
		},
		{
			unpack_14_23bit_unsigned_1off,
			unpack_14_23bit_signed_1off,
		},
		{
			unpack_14_23bit_unsigned_2off,
			unpack_14_23bit_signed_2off,
		},
		{
			unpack_14_23bit_unsigned_3off,
			unpack_14_23bit_signed_3off,
		},
		{
			unpack_14_23bit_unsigned_4off,
			unpack_14_23bit_signed_4off,
		},
		{
			unpack_14_23bit_unsigned_5off,
			unpack_14_23bit_signed_5off,
		},
		{
			unpack_14_23bit_unsigned_6off,
			unpack_14_23bit_signed_6off,
		},
		{
			unpack_14_23bit_unsigned_7off,
			unpack_14_23bit_signed_7off,
		},
	},
	{
		{
			unpack_15_23bit_unsigned_0off,
			unpack_15_23bit_signed_0off,
		},
		{
			unpack_15_23bit_unsigned_1off,
			unpack_15_23bit_signed_1off,
		},
		{
			unpack_15_23bit_unsigned_2off,
			unpack_15_23bit_signed_2off,
		},
		{
			unpack_15_23bit_unsigned_3off,
			unpack_15_23bit_signed_3off,
		},
		{
			unpack_15_23bit_unsigned_4off,
			unpack_15_23bit_signed_4off,
		},
		{
			unpack_15_23bit_unsigned_5off,
			unpack_15_23bit_signed_5off,
		},
		{
			unpack_15_23bit_unsigned_6off,
			unpack_15_23bit_signed_6off,
		},
		{
			unpack_15_23bit_unsigned_7off,
			unpack_15_23bit_signed_7off,
		},
	},
	{
		{
			unpack_16_23bit_unsigned_0off,
			unpack_16_23bit_signed_0off,
		},
		{
			unpack_16_23bit_unsigned_1off,
			unpack_16_23bit_signed_1off,
		},
		{
			unpack_16_23bit_unsigned_2off,
			unpack_16_23bit_signed_2off,
		},
		{
			unpack_16_23bit_unsigned_3off,
			unpack_16_23bit_signed_3off,
		},
		{
			unpack_16_23bit_unsigned_4off,
			unpack_16_23bit_signed_4off,
		},
		{
			unpack_16_23bit_unsigned_5off,
			unpack_16_23bit_signed_5off,
		},
		{
			unpack_16_23bit_unsigned_6off,
			unpack_16_23bit_signed_6off,
		},
		{
			unpack_16_23bit_unsigned_7off,
			unpack_16_23bit_signed_7off,
		},
	},
	{
		{
			unpack_17_23bit_unsigned_0off,
			unpack_17_23bit_signed_0off,
		},
		{
			unpack_17_23bit_unsigned_1off,
			unpack_17_23bit_signed_1off,
		},
		{
			unpack_17_23bit_unsigned_2off,
			unpack_17_23bit_signed_2off,
		},
		{
			unpack_17_23bit_unsigned_3off,
			unpack_17_23bit_signed_3off,
		},
		{
			unpack_17_23bit_unsigned_4off,
			unpack_17_23bit_signed_4off,
		},
		{
			unpack_17_23bit_unsigned_5off,
			unpack_17_23bit_signed_5off,
		},
		{
			unpack_17_23bit_unsigned_6off,
			unpack_17_23bit_signed_6off,
		},
		{
			unpack_17_23bit_unsigned_7off,
			unpack_17_23bit_signed_7off,
		},
	},
	{
		{
			unpack_18_23bit_unsigned_0off,
			unpack_18_23bit_signed_0off,
		},
		{
			unpack_18_23bit_unsigned_1off,
			unpack_18_23bit_signed_1off,
		},
		{
			unpack_18_23bit_unsigned_2off,
			unpack_18_23bit_signed_2off,
		},
		{
			unpack_18_23bit_unsigned_3off,
			unpack_18_23bit_signed_3off,
		},
		{
			unpack_18_23bit_unsigned_4off,
			unpack_18_23bit_signed_4off,
		},
		{
			unpack_18_23bit_unsigned_5off,
			unpack_18_23bit_signed_5off,
		},
		{
			unpack_18_23bit_unsigned_6off,
			unpack_18_23bit_signed_6off,
		},
		{
			unpack_18_23bit_unsigned_7off,
			unpack_18_23bit_signed_7off,
		},
	},
	{
		{
			unpack_19_23bit_unsigned_0off,
			unpack_19_23bit_signed_0off,
		},
		{
			unpack_19_23bit_unsigned_1off,
			unpack_19_23bit_signed_1off,
		},
		{
			unpack_19_23bit_unsigned_2off,
			unpack_19_23bit_signed_2off,
		},
		{
			unpack_19_23bit_unsigned_3off,
			unpack_19_23bit_signed_3off,
		},
		{
			unpack_19_23bit_unsigned_4off,
			unpack_19_23bit_signed_4off,
		},
		{
			unpack_19_23bit_unsigned_5off,
			unpack_19_23bit_signed_5off,
		},
		{
			unpack_19_23bit_unsigned_6off,
			unpack_19_23bit_signed_6off,
		},
		{
			unpack_19_23bit_unsigned_7off,
			unpack_19_23bit_signed_7off,
		},
	},
	{
		{
			unpack_20_23bit_unsigned_0off,
			unpack_20_23bit_signed_0off,
		},
		{
			unpack_20_23bit_unsigned_1off,
			unpack_20_23bit_signed_1off,
		},
		{
			unpack_20_23bit_unsigned_2off,
			unpack_20_23bit_signed_2off,
		},
		{
			unpack_20_23bit_unsigned_3off,
			unpack_20_23bit_signed_3off,
		},
		{
			unpack_20_23bit_unsigned_4off,
			unpack_20_23bit_signed_4off,
		},
		{
			unpack_20_23bit_unsigned_5off,
			unpack_20_23bit_signed_5off,
		},
		{
			unpack_20_23bit_unsigned_6off,
			unpack_20_23bit_signed_6off,
		},
		{
			unpack_20_23bit_unsigned_7off,
			unpack_20_23bit_signed_7off,
		},
	},
	{
		{
			unpack_21_23bit_unsigned_0off,
			unpack_21_23bit_signed_0off,
		},
		{
			unpack_21_23bit_unsigned_1off,
			unpack_21_23bit_signed_1off,
		},
		{
			unpack_21_23bit_unsigned_2off,
			unpack_21_23bit_signed_2off,
		},
		{
			unpack_21_23bit_unsigned_3off,
			unpack_21_23bit_signed_3off,
		},
		{
			unpack_21_23bit_unsigned_4off,
			unpack_21_23bit_signed_4off,
		},
		{
			unpack_21_23bit_unsigned_5off,
			unpack_21_23bit_signed_5off,
		},
		{
			unpack_21_23bit_unsigned_6off,
			unpack_21_23bit_signed_6off,
		},
		{
			unpack_21_23bit_unsigned_7off,
			unpack_21_23bit_signed_7off,
		},
	},
	{
		{
			unpack_22_23bit_unsigned_0off,
			unpack_22_23bit_signed_0off,
		},
		{
			unpack_22_23bit_unsigned_1off,
			unpack_22_23bit_signed_1off,
		},
		{
			unpack_22_23bit_unsigned_2off,
			unpack_22_23bit_signed_2off,
		},
		{
			unpack_22_23bit_unsigned_3off,
			unpack_22_23bit_signed_3off,
		},
		{
			unpack_22_23bit_unsigned_4off,
			unpack_22_23bit_signed_4off,
		},
		{
			unpack_22_23bit_unsigned_5off,
			unpack_22_23bit_signed_5off,
		},
		{
			unpack_22_23bit_unsigned_6off,
			unpack_22_23bit_signed_6off,
		},
		{
			unpack_22_23bit_unsigned_7off,
			unpack_22_23bit_signed_7off,
		},
	},
};
